﻿using System;
using System.IO;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;

using CE.User;
using CE.Global;
using CE.Database;
using CE.Provider;
using CE.CarInsurance;
using CE.Company;
using CE.Mail;
using CE.InputOut;

public partial class car_insurance_offline_quote : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[CE.Global.General.UserId] != null && Session[CE.Global.General.UserTypeId] != null)
        {
            if (Convert.ToInt32(Session[CE.Global.General.UserTypeId]) !=
                Convert.ToInt32(CE.Global.CEUserType.Customer) && Convert.ToInt32(Session[CE.Global.General.UserTypeId]) !=
                Convert.ToInt32(CE.Global.CEUserType.Provider))
            {
                Response.Redirect("login.aspx");
            }
        }
        else
        {
            Response.Redirect("login.aspx");
        }

        if (Session[General.CarId] == null || Session[General.CarPolicyId] == null)
        {
            string isCXLive = CE.Configuration.MyConfigurationManager.GetAppSettingValue("IsCXLive").ToString();
            Response.Redirect("~/car-insurance/");

        }

        if (!Page.IsPostBack)
        {
            ShowQuoteSummary();

            //offline quote
            string _fromDate = "";
            string _toDate = "";
            DateTime _dtNow = CE.Global.General.GetUTCDateTime();
            _dtNow = _dtNow.AddDays(-1.0d);
            _toDate = _dtNow.Day.ToString() + "/" + _dtNow.Month.ToString() + "/" + _dtNow.Year.ToString();
            _dtNow = _dtNow.AddYears(-1);
            _dtNow = _dtNow.AddDays(1.0d);
            _fromDate = _dtNow.Day.ToString() + "/" + _dtNow.Month.ToString() + "/" + _dtNow.Year.ToString();
            lblLastThreeYear.Text = _fromDate + " To " + _toDate;
            //rfvClaimValue3.ErrorMessage = "Choose Claim Value for " + lblLastThreeYear.Text + " peroid";
            //rfvNoOfClaim3.ErrorMessage = "Choose No. Of Claim for " + lblLastThreeYear.Text + " peroid";

            usrClaimLast2AccidentDate1.StartYear = _dtNow.AddYears(-1).Year;
            usrClaimLast2AccidentDate1.EndYear = _dtNow.Year;
            usrClaimLast2AccidentDate2.StartYear = _dtNow.AddYears(-1).Year;
            usrClaimLast2AccidentDate2.EndYear = _dtNow.Year;
            usrClaimLast2AccidentDate3.StartYear = _dtNow.AddYears(-1).Year;
            usrClaimLast2AccidentDate3.EndYear = _dtNow.Year;

            _dtNow = _dtNow.AddDays(-1.0d);
            _toDate = _dtNow.Day.ToString() + "/" + _dtNow.Month.ToString() + "/" + _dtNow.Year.ToString();
            _dtNow = _dtNow.AddYears(-1);
            _dtNow = _dtNow.AddDays(1.0d);
            _fromDate = _dtNow.Day.ToString() + "/" + _dtNow.Month.ToString() + "/" + _dtNow.Year.ToString();
            lblLastTwoYear.Text = _fromDate + " To " + _toDate;
            //rfvClaimValue2.ErrorMessage = "Choose Claim Value for " + lblLastTwoYear.Text + " peroid";
            //rfvNoOfClaim2.ErrorMessage = "Choose No. Of Claim for " + lblLastTwoYear.Text + " peroid";

            usrClaimLast3AccidentDate1.StartYear = _dtNow.AddYears(-1).Year;
            usrClaimLast3AccidentDate1.EndYear = _dtNow.Year;
            usrClaimLast3AccidentDate2.StartYear = _dtNow.AddYears(-1).Year;
            usrClaimLast3AccidentDate2.EndYear = _dtNow.Year;
            usrClaimLast3AccidentDate3.StartYear = _dtNow.AddYears(-1).Year;
            usrClaimLast3AccidentDate3.EndYear = _dtNow.Year;

            _dtNow = _dtNow.AddDays(-1.0d);
            _toDate = _dtNow.Day.ToString() + "/" + _dtNow.Month.ToString() + "/" + _dtNow.Year.ToString();
            _dtNow = _dtNow.AddYears(-1);
            _dtNow = _dtNow.AddDays(1.0d);
            _fromDate = _dtNow.Day.ToString() + "/" + _dtNow.Month.ToString() + "/" + _dtNow.Year.ToString();
            lblLastYear.Text = _fromDate + " To " + _toDate;

            usrClaimLast1AccidentDate1.StartYear = CE.Global.General.GetUTCDateTime().AddYears(-1).Year;
            usrClaimLast1AccidentDate1.EndYear = CE.Global.General.GetUTCDateTime().Year;
            usrClaimLast1AccidentDate2.StartYear = CE.Global.General.GetUTCDateTime().AddYears(-1).Year;
            usrClaimLast1AccidentDate2.EndYear = CE.Global.General.GetUTCDateTime().Year;
            usrClaimLast1AccidentDate3.StartYear = CE.Global.General.GetUTCDateTime().AddYears(-1).Year;
            usrClaimLast1AccidentDate3.EndYear = CE.Global.General.GetUTCDateTime().Year;

            usrDrivingLicenseDate.EndYear = CE.Global.General.GetUTCDateTime().Year;
            usrDrivingLicenseDate.StartYear = CE.Global.General.GetUTCDateTime().AddYears(-70).Year;

            usrDriver1LicensePassDate.EndYear = CE.Global.General.GetUTCDateTime().Year;
            usrDriver1LicensePassDate.StartYear = CE.Global.General.GetUTCDateTime().AddYears(-70).Year;
            usrDriver2LicensePassDate.EndYear = CE.Global.General.GetUTCDateTime().Year;
            usrDriver2LicensePassDate.StartYear = CE.Global.General.GetUTCDateTime().AddYears(-70).Year;
            usrDriver3LicensePassDate.EndYear = CE.Global.General.GetUTCDateTime().Year;
            usrDriver3LicensePassDate.StartYear = CE.Global.General.GetUTCDateTime().AddYears(-70).Year;
            usrDriver4LicensePassDate.EndYear = CE.Global.General.GetUTCDateTime().Year;
            usrDriver4LicensePassDate.StartYear = CE.Global.General.GetUTCDateTime().AddYears(-70).Year;
            usrDriver5LicensePassDate.EndYear = CE.Global.General.GetUTCDateTime().Year;
            usrDriver5LicensePassDate.StartYear = CE.Global.General.GetUTCDateTime().AddYears(-70).Year;

            //end of offline quote

            btnNoMatchBack.Visible = false;

            txtFullName.Attributes.Add("onblur", "ShowValidationEffectTwo('" + txtFullName.ClientID + "','" + rfvFullName.ClientID + "','" + revFullName.ClientID + "')");
            txtVehicleNo.Attributes.Add("onblur", "this.value=removeSpaces(this.value);ShowValidationEffectTwo('" + txtVehicleNo.ClientID + "','" + rfvVehicleNo.ClientID + "','" + revVehicleNo.ClientID + "')");

            rdoSuspensionYes.Attributes.Add("onblur", "CheckSuspensionValidationCss();");
            rdoSuspensionNo.Attributes.Add("onblur", "CheckSuspensionValidationCss();");

            rdoCancelledYes.Attributes.Add("onblur", "CheckCancelledValidationCss();");
            rdoCancelledNo.Attributes.Add("onblur", "CheckCancelledValidationCss();");

            lblRMessage.Text = "Result: No Matches Found!";

            if (Convert.ToInt32(lblYrofManufacture.Text) >= CE.Global.General.GetUTCDateTime().Year - 10)
            {
                LoadNoMatchCoverType(10);
            }
            else
            {
                LoadNoMatchCoverType(20);
            }
            
            bool isSubmitted = GetReferenceUser(Convert.ToInt64(Session[CE.Global.General.UserId].ToString()), Convert.ToInt64(Session[CE.Global.General.CarId].ToString()), "CI");

        }

    }

    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (Session[CE.Global.General.UserId] != null && Session[CE.Global.General.CarId] != null)
        {
            txtFullName.Text = General.ClearScriptTag(txtFullName.Text);
            txtVehicleNo.Text = General.ClearScriptTag(txtVehicleNo.Text);
            //CheckValidation();
            ChangeValidationEffectServerSide("carrefuser");
            if (IsValid)
            {

                string _filePath = "";
                string _fileName = "";
                _filePath = GetFilePath();
                _fileName = Session[General.CarId].ToString() + "_" + CE.Global.General.GetUTCDateTime().ToString("yyyyMMMdd") + ".xls";

                Int64 _result = 0;
                ReferenceUser _referenceuser = new ReferenceUser();
                ReferenceUserDB _referenceuserdb = new ReferenceUserDB();


                txtFullName.Text = General.ClearScriptTag(txtFullName.Text);
                txtFullName.Text = Server.HtmlEncode(txtFullName.Text);

                txtEmail.Text = General.ClearScriptTag(txtEmail.Text);
                txtEmail.Text = Server.HtmlEncode(txtEmail.Text);

                txtVehicleNo.Text = General.ClearScriptTag(txtVehicleNo.Text);
                txtVehicleNo.Text = Server.HtmlEncode(txtVehicleNo.Text);

                _referenceuser.RefCEUserId = Convert.ToInt64(Session[General.UserId].ToString());
                _referenceuser.ProductType = "CI";
                _referenceuser.ProductId = Convert.ToInt64(Session[General.CarId].ToString());
                _referenceuser.FullName = txtFullName.Text.Trim();
                _referenceuser.NRIC = ddlIdNumber.GetIdNumber();
                _referenceuser.VehicleNumber = txtVehicleNo.Text.Trim();
                _referenceuser.MobileNumber = txtMobileNo.GetPhoneNo();
                _referenceuser.Email = txtEmail.Text.Trim();
                _referenceuser.Info1 = _filePath + _fileName;
                _referenceuser.ProviderCoverTypeId = Convert.ToInt64(ddlNoMatchCoverType.Text);

                if (ddlNoMatchCoverType.SelectedValue == "1")
                {
                    _referenceuser.Info2 = ddlComprehensiveDetails.Text;
                }
                else
                {
                    _referenceuser.Info2 = "";
                }

                _referenceuser.Info3 = ddlImportant.Text;

                _referenceuser.AgentId = 0;
                _referenceuser.Status = true;
                _result = _referenceuserdb.Insert(_referenceuser);

                if (_result > 0)
                {
                    //other details
                    Int64 _detailsresult = 0;
                    ReferenceUserOtherDetails _referenceuserothers = new ReferenceUserOtherDetails();
                    ReferenceUserOtherDetailsDB _referenceuserothersdb = new ReferenceUserOtherDetailsDB();

                    _referenceuserothers.UserId = _result;
                    _referenceuserothers.CeCarId = _referenceuser.ProductId;
                    _referenceuserothers.DrivingLicensePassDate = Convert.ToDateTime(usrDrivingLicenseDate.GetDate());

                    if (ddlNoOfClaim3.SelectedIndex > 0)
                    {
                        _referenceuserothers.NOCLast3 = Convert.ToInt32(ddlNoOfClaim3.Text);

                        if (tblLast3Claim1.Visible)
                        {
                            _referenceuserothers.NOCLast3Claim1NotAtFault = txtClaimLast3NAF1.Text;
                            _referenceuserothers.NOCLast3Claim1AtFault = txtClaimLast3AF1.Text;
                            _referenceuserothers.NOCLast3Claim1Windscreen = txtClaimLast3Windscreen1.Text;
                            _referenceuserothers.NOCLast3Claim1AccidentDate = usrClaimLast3AccidentDate1.GetDate();

                        }

                        if (tblLast3Claim2.Visible)
                        {
                            _referenceuserothers.NOCLast3Claim2NotAtFault = txtClaimLast3NAF2.Text;
                            _referenceuserothers.NOCLast3Claim2AtFault = txtClaimLast3AF2.Text;
                            _referenceuserothers.NOCLast3Claim2Windscreen = txtClaimLast3Windscreen2.Text;
                            _referenceuserothers.NOCLast3Claim2AccidentDate = usrClaimLast3AccidentDate2.GetDate();
                        }

                        if (tblLast3Claim3.Visible)
                        {
                            _referenceuserothers.NOCLast3Claim3NotAtFault = txtClaimLast3NAF3.Text;
                            _referenceuserothers.NOCLast3Claim3AtFault = txtClaimLast3AF3.Text;
                            _referenceuserothers.NOCLast3Claim3Windscreen = txtClaimLast3Windscreen3.Text;
                            _referenceuserothers.NOCLast3Claim3AccidentDate = usrClaimLast3AccidentDate3.GetDate();
                        }

                    }
                    else
                    {
                        _referenceuserothers.NOCLast3 = 0;
                    }


                    if (ddlNoOfClaim2.SelectedIndex > 0)
                    {
                        _referenceuserothers.NOCLast2 = Convert.ToInt32(ddlNoOfClaim2.Text);

                        if (tblLast2Claim1.Visible)
                        {
                            _referenceuserothers.NOCLast2Claim1NotAtFault = txtClaimLast2NAF1.Text;
                            _referenceuserothers.NOCLast2Claim1AtFault = txtClaimLast2AF1.Text;
                            _referenceuserothers.NOCLast2Claim1Windscreen = txtClaimLast2Windscreen1.Text;
                            _referenceuserothers.NOCLast2Claim1AccidentDate = usrClaimLast2AccidentDate1.GetDate();
                        }

                        if (tblLast2Claim2.Visible)
                        {
                            _referenceuserothers.NOCLast2Claim2NotAtFault = txtClaimLast2NAF2.Text;
                            _referenceuserothers.NOCLast2Claim2AtFault = txtClaimLast2AF2.Text;
                            _referenceuserothers.NOCLast2Claim2Windscreen = txtClaimLast2Windscreen2.Text;
                            _referenceuserothers.NOCLast2Claim2AccidentDate = usrClaimLast2AccidentDate2.GetDate();
                        }

                        if (tblLast2Claim3.Visible)
                        {
                            _referenceuserothers.NOCLast2Claim3NotAtFault = txtClaimLast2NAF3.Text;
                            _referenceuserothers.NOCLast2Claim3AtFault = txtClaimLast2AF3.Text;
                            _referenceuserothers.NOCLast2Claim3Windscreen = txtClaimLast2Windscreen3.Text;
                            _referenceuserothers.NOCLast2Claim3AccidentDate = usrClaimLast2AccidentDate3.GetDate();
                        }

                    }
                    else
                    {
                        _referenceuserothers.NOCLast2 = 0;
                    }

                    if (ddlNoOfClaim1.SelectedIndex > 0)
                    {
                        _referenceuserothers.NOCLast1 = Convert.ToInt32(ddlNoOfClaim1.Text);

                        if (tblLast1Claim1.Visible)
                        {
                            _referenceuserothers.NOCLast1Claim1NotAtFault = txtClaimLast1NAF1.Text;
                            _referenceuserothers.NOCLast1Claim1AtFault = txtClaimLast1AF1.Text;
                            _referenceuserothers.NOCLast1Claim1Windscreen = txtClaimLast1Windscreen1.Text;
                            _referenceuserothers.NOCLast1Claim1AccidentDate = usrClaimLast1AccidentDate1.GetDate();
                        }

                        if (tblLast1Claim2.Visible)
                        {
                            _referenceuserothers.NOCLast1Claim2NotAtFault = txtClaimLast1NAF2.Text;
                            _referenceuserothers.NOCLast1Claim2AtFault = txtClaimLast1AF2.Text;
                            _referenceuserothers.NOCLast1Claim2Windscreen = txtClaimLast1Windscreen2.Text;
                            _referenceuserothers.NOCLast1Claim2AccidentDate = usrClaimLast1AccidentDate2.GetDate();
                        }

                        if (tblLast1Claim3.Visible)
                        {
                            _referenceuserothers.NOCLast1Claim3NotAtFault = txtClaimLast1NAF3.Text;
                            _referenceuserothers.NOCLast1Claim3AtFault = txtClaimLast1AF3.Text;
                            _referenceuserothers.NOCLast1Claim3Windscreen = txtClaimLast1Windscreen3.Text;
                            _referenceuserothers.NOCLast1Claim3AccidentDate = usrClaimLast1AccidentDate3.GetDate();
                        }

                    }
                    else
                    {
                        _referenceuserothers.NOCLast1 = 0;
                    }

                    _referenceuserothers.SuspensionOfLicense = rdoSuspensionYes.Checked;
                    _referenceuserothers.PolicyCancelled = rdoCancelledYes.Checked;

                    _referenceuserothers.RenewalQuoteReceived = Convert.ToSingle(txtRenewalQuoteReceived.Text);

                    if (divAdditionalDriver.Visible == true)
                    {
                        _referenceuserothers.AddDriver = true;
                    }
                    else
                    {
                        _referenceuserothers.AddDriver = false;
                    }

                    _referenceuserothers.Driver1Relation = General.ClearScriptTag(txtDriver1Relation.Text.Trim());
                    _referenceuserothers.Driver1Name = General.ClearScriptTag(txtDriver1Name.Text.Trim());
                    _referenceuserothers.Driver1NRIC = usrDriver1NRIC.GetIdNumber();
                    _referenceuserothers.Driver1LicensePassDate = usrDriver1LicensePassDate.GetDate();

                    _referenceuserothers.Driver2Relation = General.ClearScriptTag(txtDriver2Relation.Text.Trim());
                    _referenceuserothers.Driver2Name = General.ClearScriptTag(txtDriver2Name.Text.Trim());
                    _referenceuserothers.Driver2NRIC = usrDriver2NRIC.GetIdNumber();
                    _referenceuserothers.Driver2LicensePassDate = usrDriver2LicensePassDate.GetDate();

                    _referenceuserothers.Driver3Relation = General.ClearScriptTag(txtDriver3Relation.Text.Trim());
                    _referenceuserothers.Driver3Name = General.ClearScriptTag(txtDriver3Name.Text.Trim());
                    _referenceuserothers.Driver3NRIC = usrDriver3NRIC.GetIdNumber();
                    _referenceuserothers.Driver3LicensePassDate = usrDriver3LicensePassDate.GetDate();

                    _referenceuserothers.Driver4Relation = General.ClearScriptTag(txtDriver4Relation.Text.Trim());
                    _referenceuserothers.Driver4Name = General.ClearScriptTag(txtDriver4Name.Text.Trim());
                    _referenceuserothers.Driver4NRIC = usrDriver4NRIC.GetIdNumber();
                    _referenceuserothers.Driver4LicensePassDate = usrDriver4LicensePassDate.GetDate();

                    _referenceuserothers.Driver5Relation = General.ClearScriptTag(txtDriver5Relation.Text.Trim());
                    _referenceuserothers.Driver5Name = General.ClearScriptTag(txtDriver5Name.Text.Trim());
                    _referenceuserothers.Driver5NRIC = usrDriver5NRIC.GetIdNumber();
                    _referenceuserothers.Driver5LicensePassDate = usrDriver5LicensePassDate.GetDate();

                    _referenceuserothers.ViewedDetailId = 0;
                    _referenceuserothers.Status = true;
                    _referenceuserothers.RefCEUserId = _referenceuser.RefCEUserId;

                    _detailsresult = _referenceuserothersdb.Insert(_referenceuserothers);

                    if (_detailsresult > 0)
                    {

                        GenerateExcelQuote(_filePath, _fileName);

                        CXAgent _cxagent = new CXAgent();
                        CXAgentDB _cxagentdb = new CXAgentDB();
                        Int64 _ProductId = 0;
                        Int64 _AgentId = 0;
                        Int64 _CEID = Convert.ToInt64(Session[General.UserId].ToString());
                        string _AgentName = "";
                        string _AgentEmail = "";
                        DataTable _dtCXAgent = _cxagentdb.GetCXAgentList(_CEID, "CI", 0);
                        //DataTable _dtCXAgent = _cxagentdb.GetCXAgentList("CI", 0);
                        if (_dtCXAgent != null && _dtCXAgent.Rows.Count > 0)
                        {
                            _AgentId = Convert.ToInt64(_dtCXAgent.Rows[0]["AgentId"].ToString());
                            _AgentName = _dtCXAgent.Rows[0]["AgentName"].ToString();
                            _AgentEmail = _dtCXAgent.Rows[0]["Email"].ToString();

                            _ProductId = Convert.ToInt64(Session[General.CarId].ToString());
                            _referenceuserdb.Update(_CEID, _AgentId, "CI", _ProductId);
                            //_referenceuserdb.Update(_AgentId, "CI", _ProductId);

                            //Sakthi on 27 Apr 2011 -- Start
                            string _message = "Customer Name: " + txtFullName.Text;
                            string _title = "Offline Quotes request by " + txtFullName.Text;
                            _message += "<br/><br/>Car ID : " + Session[General.CarId].ToString();
                            _message += "<br/><br/>Customer Email : " + txtEmail.Text;
                            _message += "<br/><br/>Contact No : " + txtMobileNo.GetPhoneNo();
                            _message += "<br/><br/>Make/Model : " + lblCarMakemodelTop.Text;
                            _message += "<br/><br/>Commencement Date : " + lblCommencementdateTop.Text;
                            _message += "<br/><br/>Cover Type : " + ddlNoMatchCoverType.SelectedItem.Text;
                            _message += "<br/><br/>Agent Name : " + _AgentName;
                            MyMailManager.SendCXBrokerNotification(_AgentEmail, _title, _message);
                            //Sakthi on 27 Apr 2011 -- End

                            General.ClearAllSession(this.Page, "ALL");
                            //Response.Redirect("~/User/UserMessage.aspx?mt=UM&ec=701");
                            Response.Redirect("~/user/user-meaasge.aspx");
                        }
                    }
                }
            }
        }
    }

    protected void ibtRunNewQuote_Click(object sender, ImageClickEventArgs e)
    {
        CE.Global.General.ClearAllSession(this.Page, "AL");
        Response.Redirect("~/car-insurance/");
    }

    protected void btnNewQuote_Click(object sender, EventArgs e)
    {
        CE.Global.General.ClearAllSession(this.Page, "AL");
        Response.Redirect("~/car-insurance/");
    }


    protected void ibtRunNewQuoteforNomatch_Click(object sender, ImageClickEventArgs e)
    {
        CE.Global.General.ClearAllSession(this.Page, "AL");
        Response.Redirect("~/car-insurance/");
    }

    protected void btnOfflineBack_Click(object sender, EventArgs e)
    {
        Response.Redirect("profile.aspx");
    }

    protected void btnNoMatchBack_Click(object sender, EventArgs e)
    {
        Response.Redirect("profile.aspx");
    }
    
    protected void GenerateExcelQuote(string FilePath, string FileName)
    {
        Label lblContent = new Label();
        string _fileName = "FileName";

        StringBuilder strText = new StringBuilder("");
        strText.Append("<table><tr><td colspan='4'><h3>Car Insurance : Quote Request</h3></td></tr></table>");

        #region Variable Declaration

        string _html, _name, _gender, _nric, _dob, _dd, _mm, _yy, _occupation, _jobnature, _maritalstatus, _yearsofdriving, _manufactureyear, _registeryear;
        string _carmodel, _offpeek, _ncdpercent, _applicablencd, _offancedriving, _additionaldriver, _commencementdate, _email, _mobile, _vehicleno, _inscomp;
        string _drname1, _drage1, _drgender1, _drmarital1, _drocc1, _drexp1, _drjobnature1, _drname2, _drage2, _drgender2, _drmarital2, _drocc2, _drexp2, _drjobnature2;
        string _drname3, _drage3, _drgender3, _drmarital3, _drocc3, _drexp3, _drjobnature3, _drname4, _drage4, _drgender4, _drmarital4, _drocc4, _drexp4, _drjobnature4;
        string _drname5, _drage5, _drgender5, _drmarital5, _drocc5, _drexp5, _drjobnature5, _drcount, _drDOB1, _drDOB2, _drDOB3, _drDOB4, _drDOB5, _indd, _inmm, _inyy;
        string _claimstatus, _claim1ststat, _claim1stend, _claimcount1, claimamt1, _claim2ndstat, _claim2ndend, claimamt2, _claim3rdstat, _claim3rdend, claimamt3;
        string _insdate, _covertypedesc, _info2, _info3;

        string _noofclaimlast3, _claimlast3NAF1, _claimlast3AF1, _claimlast3Windscreen1, _claimlast3NAF2, _claimlast3AF2, _claimlast3Windscreen2, _claimlast3NAF3, _claimlast3AF3, _claimlast3Windscreen3;
        string _noofclaimlast2, _claimlast2NAF1, _claimlast2AF1, _claimlast2Windscreen1, _claimlast2NAF2, _claimlast2AF2, _claimlast2Windscreen2, _claimlast2NAF3, _claimlast2AF3, _claimlast2Windscreen3;
        string _noofclaimlast1, _claimlast1NAF1, _claimlast1AF1, _claimlast1Windscreen1, _claimlast1NAF2, _claimlast1AF2, _claimlast1Windscreen2, _claimlast1NAF3, _claimlast1AF3, _claimlast1Windscreen3;
        string _suspension, _policycancelled, _driver1relation, _driver2relation, _driver3relation, _driver4relation, _driver5relation, _reftableuserid;
        string _renewalquote, _driver1name, _driver1nric, _driver2name, _driver2nric;
        string _driver3name, _driver3nric, _driver4name, _driver4nric, _driver5name, _driver5nric;

        DateTime _ddob, _indate;
        DateTime _drddob1 = CE.Global.General.GetUTCDateTime();
        DateTime _drddob2 = CE.Global.General.GetUTCDateTime();
        DateTime _drddob3 = CE.Global.General.GetUTCDateTime();
        DateTime _drddob4 = CE.Global.General.GetUTCDateTime();
        DateTime _drddob5 = CE.Global.General.GetUTCDateTime();
        DateTime _drivinglicensepass = CE.Global.General.GetUTCDateTime();
        DateTime _claimlast3AccidentDate1 = CE.Global.General.GetUTCDateTime();
        DateTime _claimlast3AccidentDate2 = CE.Global.General.GetUTCDateTime();
        DateTime _claimlast3AccidentDate3 = CE.Global.General.GetUTCDateTime();
        DateTime _claimlast2AccidentDate1 = CE.Global.General.GetUTCDateTime();
        DateTime _claimlast2AccidentDate2 = CE.Global.General.GetUTCDateTime();
        DateTime _claimlast2AccidentDate3 = CE.Global.General.GetUTCDateTime();
        DateTime _claimlast1AccidentDate1 = CE.Global.General.GetUTCDateTime();
        DateTime _claimlast1AccidentDate2 = CE.Global.General.GetUTCDateTime();
        DateTime _claimlast1AccidentDate3 = CE.Global.General.GetUTCDateTime();

        DateTime _driver1licensepassdate = CE.Global.General.GetUTCDateTime();
        DateTime _driver2licensepassdate = CE.Global.General.GetUTCDateTime();
        DateTime _driver3licensepassdate = CE.Global.General.GetUTCDateTime();
        DateTime _driver4licensepassdate = CE.Global.General.GetUTCDateTime();
        DateTime _driver5licensepassdate = CE.Global.General.GetUTCDateTime();

        _html = ""; _name = ""; _gender = ""; _nric = ""; _dob = ""; _dd = ""; _mm = ""; _yy = ""; _occupation = ""; _jobnature = ""; _maritalstatus = "";
        _yearsofdriving = ""; _manufactureyear = ""; _registeryear = ""; _carmodel = ""; _offpeek = ""; _ncdpercent = ""; _applicablencd = "";
        _offancedriving = ""; _additionaldriver = ""; _commencementdate = ""; _email = ""; _mobile = ""; _vehicleno = ""; _inscomp = "";
        _drname1 = ""; _drage1 = ""; _drgender1 = ""; _drmarital1 = ""; _drocc1 = ""; _drexp1 = ""; _drjobnature1 = "";
        _drname2 = ""; _drage2 = ""; _drgender2 = ""; _drmarital2 = ""; _drocc2 = ""; _drexp2 = ""; _drjobnature2 = "";
        _drname3 = ""; _drage3 = ""; _drgender3 = ""; _drmarital3 = ""; _drocc3 = ""; _drexp3 = ""; _drjobnature3 = "";
        _drname4 = ""; _drage4 = ""; _drgender4 = ""; _drmarital4 = ""; _drocc4 = ""; _drexp4 = ""; _drjobnature4 = "";
        _drname5 = ""; _drage5 = ""; _drgender5 = ""; _drmarital5 = ""; _drocc5 = ""; _drexp5 = ""; _drjobnature5 = ""; _drcount = "0";
        _drDOB1 = ""; _drDOB2 = ""; _drDOB3 = ""; _drDOB4 = ""; _drDOB5 = ""; _indd = ""; _inmm = ""; _inyy = "";
        _claimstatus = ""; _claim1ststat = ""; _claim1stend = ""; _claimcount1 = ""; claimamt1 = ""; _claim2ndstat = ""; _claim2ndend = "";
        claimamt2 = ""; _claim3rdstat = ""; _claim3rdend = ""; claimamt3 = ""; _covertypedesc = ""; _info2 = ""; _info3 = "";

        _noofclaimlast3 = ""; _claimlast3NAF1 = ""; _claimlast3AF1 = ""; _claimlast3Windscreen1 = ""; _claimlast3NAF2 = ""; _claimlast3AF2 = ""; _claimlast3Windscreen2 = ""; _claimlast3NAF3 = ""; _claimlast3AF3 = ""; _claimlast3Windscreen3 = "";
        _noofclaimlast2 = ""; _claimlast2NAF1 = ""; _claimlast2AF1 = ""; _claimlast2Windscreen1 = ""; _claimlast2NAF2 = ""; _claimlast2AF2 = ""; _claimlast2Windscreen2 = ""; _claimlast2NAF3 = ""; _claimlast2AF3 = ""; _claimlast2Windscreen3 = "";
        _noofclaimlast1 = ""; _claimlast1NAF1 = ""; _claimlast1AF1 = ""; _claimlast1Windscreen1 = ""; _claimlast1NAF2 = ""; _claimlast1AF2 = ""; _claimlast1Windscreen2 = ""; _claimlast1NAF3 = ""; _claimlast1AF3 = ""; _claimlast1Windscreen3 = "";
        _suspension = ""; _policycancelled = ""; _driver1relation = ""; _driver2relation = ""; _driver3relation = ""; _driver4relation = ""; _driver5relation = ""; _reftableuserid = "";

        _renewalquote = ""; _driver1name = ""; _driver1nric = ""; _driver2name = ""; _driver2nric = ""; _driver3name = ""; _driver3nric = "";
        _driver4name = ""; _driver4nric = ""; _driver5name = ""; _driver5nric = "";

        #endregion
        CarInsuranceDB _carinsurancedb = new CarInsuranceDB();

        Int64 _RefId = Convert.ToInt64(Session[General.CarId].ToString());
        Int64 _UserId = Convert.ToInt64(Session[General.UserId].ToString());
        DataSet _dsNomatchFound = new DataSet();
        _dsNomatchFound = _carinsurancedb.GetCINomatchFoundQuotes(_RefId, _UserId, "CI");
        if (_dsNomatchFound.Tables[0].Rows.Count > 0)
        {
            #region variables
            _name = _dsNomatchFound.Tables[0].Rows[0]["Name"].ToString();
            _nric = _dsNomatchFound.Tables[0].Rows[0]["NRIC"].ToString();
            _manufactureyear = _dsNomatchFound.Tables[0].Rows[0]["ManufactYear"].ToString();
            _registeryear = _dsNomatchFound.Tables[0].Rows[0]["RegYear"].ToString();
            _carmodel = _dsNomatchFound.Tables[0].Rows[0]["MakeModelDesc"].ToString();
            _ddob = Convert.ToDateTime(_dsNomatchFound.Tables[0].Rows[0]["DOB"].ToString());
            _dd = _ddob.Day.ToString("00");
            _mm = _ddob.Month.ToString("00");
            _yy = _ddob.Year.ToString();
            _dob = _dd + "/" + _mm + "/" + _yy;
            //_dob = _dsNomatchFound.Tables[0].Rows[0]["DOB"].ToString();
            _maritalstatus = _dsNomatchFound.Tables[0].Rows[0]["Marital"].ToString();
            _gender = _dsNomatchFound.Tables[0].Rows[0]["Gender"].ToString();
            _jobnature = _dsNomatchFound.Tables[0].Rows[0]["JobNature"].ToString();
            _email = _dsNomatchFound.Tables[0].Rows[0]["Email"].ToString();
            _yearsofdriving = _dsNomatchFound.Tables[0].Rows[0]["YearDriveSg"].ToString();
            _occupation = _dsNomatchFound.Tables[0].Rows[0]["Description"].ToString();
            _mobile = _dsNomatchFound.Tables[0].Rows[0]["Mobile"].ToString();

            _reftableuserid = _dsNomatchFound.Tables[0].Rows[0]["UserId"].ToString();
            _covertypedesc = _dsNomatchFound.Tables[0].Rows[0]["ProviderCoverTypeDesc"].ToString();

            _info2 = _dsNomatchFound.Tables[0].Rows[0]["info2"].ToString();
            _info3 = _dsNomatchFound.Tables[0].Rows[0]["info3"].ToString();

            if (_dsNomatchFound.Tables[0].Rows[0]["IsClaimLastThreeYear"].ToString() == "0")
            {
                _claimstatus = "No";
            }
            else
            {
                _claimstatus = "Yes";
            }
            _ncdpercent = _dsNomatchFound.Tables[0].Rows[0]["NCDPercent"].ToString();
            if (_ncdpercent.ToString() == "-1")
            {
                _ncdpercent = "No NCD(First Policy)";
            }
            else
            {
                _ncdpercent += "%";
            }
            _applicablencd = _dsNomatchFound.Tables[0].Rows[0]["ApplicableNCD"].ToString();
            _additionaldriver = _dsNomatchFound.Tables[0].Rows[0]["AddDriver"].ToString();
            _offpeek = _dsNomatchFound.Tables[0].Rows[0]["Offbeak"].ToString();
            _offancedriving = _dsNomatchFound.Tables[0].Rows[0]["IsOffDriveCom"].ToString();
            _drcount = _dsNomatchFound.Tables[0].Rows[0]["NoOfDriver"].ToString();
            if (_dsNomatchFound.Tables[1].Rows.Count > 0)
            {
                _claimstatus = "Yes";
                _claim1ststat = _dsNomatchFound.Tables[1].Rows[0]["Claim1stStartDate"].ToString();
                _claim1stend = _dsNomatchFound.Tables[1].Rows[0]["Claim1stEndDate"].ToString();
                claimamt1 = _dsNomatchFound.Tables[1].Rows[0]["NOCLast1Value"].ToString();
                _claimcount1 = _dsNomatchFound.Tables[1].Rows[0]["NOCLast1"].ToString();

                _claim2ndstat = _dsNomatchFound.Tables[1].Rows[0]["Claim2ndStartDate"].ToString();
                _claim2ndend = _dsNomatchFound.Tables[1].Rows[0]["Claim2ndEndDate"].ToString();
                claimamt2 = _dsNomatchFound.Tables[1].Rows[0]["NOCLast2Value"].ToString();

                _claim3rdstat = _dsNomatchFound.Tables[1].Rows[0]["Claim3rdStartDate"].ToString();
                _claim3rdend = _dsNomatchFound.Tables[1].Rows[0]["Claim3rdEndDate"].ToString();
                claimamt3 = _dsNomatchFound.Tables[1].Rows[0]["NOCLast3Value"].ToString();
            }
            else
            {
                _claim1ststat = "";
                _claim1stend = "";
                claimamt1 = "";
                _claimcount1 = "0";

                _claim2ndstat = "";
                _claim2ndend = "";
                claimamt2 = "";

                _claim3rdstat = "";
                _claim3rdend = "";
                claimamt3 = "";
                _claimstatus = "No";
            }


            _vehicleno = _dsNomatchFound.Tables[0].Rows[0]["VehicleNumber"].ToString();
            _indate = Convert.ToDateTime(_dsNomatchFound.Tables[0].Rows[0]["CoverageCommenceDate"].ToString());
            _indd = _indate.Day.ToString("00");
            _inmm = _indate.Month.ToString("00");
            _inyy = _indate.Year.ToString();
            _insdate = _indd + "/" + _inmm + "/" + _inyy;
            if (_dsNomatchFound.Tables[2].Rows.Count > 0)
            {
                _inscomp = _dsNomatchFound.Tables[2].Rows[0]["InsCompanyName"].ToString();
            }
            if (_dsNomatchFound.Tables[3].Rows.Count > 0)
            {
                if (Convert.ToInt16(_drcount) > 0)
                {
                    _drage1 = _dsNomatchFound.Tables[3].Rows[0]["Age"].ToString();
                    _drgender1 = _dsNomatchFound.Tables[3].Rows[0]["Gender"].ToString();
                    _drmarital1 = _dsNomatchFound.Tables[3].Rows[0]["Marital"].ToString();
                    _drocc1 = _dsNomatchFound.Tables[3].Rows[0]["Description"].ToString();
                    _drexp1 = _dsNomatchFound.Tables[3].Rows[0]["YearOfDrivingInSg"].ToString();
                    _drDOB1 = _dsNomatchFound.Tables[3].Rows[0]["DOB"].ToString();
                    //_drddob1 = Convert.ToDateTime(_dsNomatchFound.Tables[3].Rows[0]["DOB"].ToString());
                    _drjobnature1 = _dsNomatchFound.Tables[3].Rows[0]["JobNature"].ToString();
                }
                if (Convert.ToInt16(_drcount) > 1)
                {
                    _drage2 = _dsNomatchFound.Tables[3].Rows[1]["Age"].ToString();
                    _drgender2 = _dsNomatchFound.Tables[3].Rows[1]["Gender"].ToString();
                    _drmarital2 = _dsNomatchFound.Tables[3].Rows[1]["Marital"].ToString();
                    _drocc2 = _dsNomatchFound.Tables[3].Rows[1]["Description"].ToString();
                    _drexp2 = _dsNomatchFound.Tables[3].Rows[1]["YearOfDrivingInSg"].ToString();
                    _drDOB2 = _dsNomatchFound.Tables[3].Rows[1]["DOB"].ToString();
                    //_drddob2 = Convert.ToDateTime(_dsNomatchFound.Tables[3].Rows[1]["DOB"].ToString());
                    _drjobnature2 = _dsNomatchFound.Tables[3].Rows[1]["JobNature"].ToString();
                }
                if (Convert.ToInt16(_drcount) > 2)
                {
                    _drage3 = _dsNomatchFound.Tables[3].Rows[2]["Age"].ToString();
                    _drgender3 = _dsNomatchFound.Tables[3].Rows[2]["Gender"].ToString();
                    _drmarital3 = _dsNomatchFound.Tables[3].Rows[2]["Marital"].ToString();
                    _drocc3 = _dsNomatchFound.Tables[3].Rows[2]["Description"].ToString();
                    _drexp3 = _dsNomatchFound.Tables[3].Rows[2]["YearOfDrivingInSg"].ToString();
                    _drDOB3 = _dsNomatchFound.Tables[3].Rows[2]["DOB"].ToString();
                    //_drddob3 = Convert.ToDateTime(_dsNomatchFound.Tables[3].Rows[2]["DOB"].ToString());
                    _drjobnature3 = _dsNomatchFound.Tables[3].Rows[2]["JobNature"].ToString();
                }
                if (Convert.ToInt16(_drcount) > 3)
                {
                    _drage4 = _dsNomatchFound.Tables[3].Rows[3]["Age"].ToString();
                    _drgender4 = _dsNomatchFound.Tables[3].Rows[3]["Gender"].ToString();
                    _drmarital4 = _dsNomatchFound.Tables[3].Rows[3]["Marital"].ToString();
                    _drocc4 = _dsNomatchFound.Tables[3].Rows[3]["Description"].ToString();
                    _drexp4 = _dsNomatchFound.Tables[3].Rows[3]["YearOfDrivingInSg"].ToString();
                    _drDOB4 = _dsNomatchFound.Tables[3].Rows[3]["DOB"].ToString();
                    //_drddob4 = Convert.ToDateTime(_dsNomatchFound.Tables[3].Rows[3]["DOB"].ToString());
                    _drjobnature4 = _dsNomatchFound.Tables[3].Rows[3]["JobNature"].ToString();
                }
                if (Convert.ToInt16(_drcount) > 4)
                {
                    _drage5 = _dsNomatchFound.Tables[3].Rows[4]["Age"].ToString();
                    _drgender5 = _dsNomatchFound.Tables[3].Rows[4]["Gender"].ToString();
                    _drmarital5 = _dsNomatchFound.Tables[3].Rows[4]["Marital"].ToString();
                    _drocc5 = _dsNomatchFound.Tables[3].Rows[4]["Description"].ToString();
                    _drexp5 = _dsNomatchFound.Tables[3].Rows[4]["YearOfDrivingInSg"].ToString();
                    _drDOB5 = _dsNomatchFound.Tables[3].Rows[4]["DOB"].ToString();
                    //_drddob5 = Convert.ToDateTime(_dsNomatchFound.Tables[3].Rows[4]["DOB"].ToString());
                    _drjobnature5 = _dsNomatchFound.Tables[3].Rows[4]["JobNature"].ToString();
                }
            }

            #endregion

            #region refotherdetails variables

            ReferenceUserOtherDetails refothers = new ReferenceUserOtherDetails();
            ReferenceUserOtherDetailsDB refothersDB = new ReferenceUserOtherDetailsDB();

            refothers = refothersDB.GetReferenceUserOtherDetails(_UserId, _RefId, Convert.ToInt64(_reftableuserid));

            if (refothers != null)
            {
                _drivinglicensepass = refothers.DrivingLicensePassDate;

                _noofclaimlast3 = refothers.NOCLast3.ToString();
                _claimlast3NAF1 = refothers.NOCLast3Claim1NotAtFault;
                _claimlast3AF1 = refothers.NOCLast3Claim1AtFault;
                _claimlast3Windscreen1 = refothers.NOCLast3Claim1Windscreen;
                _claimlast3AccidentDate1 = refothers.NOCLast3Claim1AccidentDate;

                _claimlast3NAF2 = refothers.NOCLast3Claim2NotAtFault;
                _claimlast3AF2 = refothers.NOCLast3Claim2AtFault;
                _claimlast3Windscreen2 = refothers.NOCLast3Claim2Windscreen;
                _claimlast3AccidentDate2 = refothers.NOCLast3Claim2AccidentDate;

                _claimlast3NAF3 = refothers.NOCLast3Claim3NotAtFault;
                _claimlast3AF3 = refothers.NOCLast3Claim3AtFault;
                _claimlast3Windscreen3 = refothers.NOCLast3Claim3Windscreen;
                _claimlast3AccidentDate3 = refothers.NOCLast3Claim3AccidentDate;

                _noofclaimlast2 = refothers.NOCLast2.ToString();
                _claimlast2NAF1 = refothers.NOCLast2Claim1NotAtFault;
                _claimlast2AF1 = refothers.NOCLast2Claim1AtFault;
                _claimlast2Windscreen1 = refothers.NOCLast2Claim1Windscreen;
                _claimlast2AccidentDate1 = refothers.NOCLast2Claim1AccidentDate;

                _claimlast2NAF2 = refothers.NOCLast2Claim2NotAtFault;
                _claimlast2AF2 = refothers.NOCLast2Claim2AtFault;
                _claimlast2Windscreen2 = refothers.NOCLast2Claim2Windscreen;
                _claimlast2AccidentDate2 = refothers.NOCLast2Claim2AccidentDate;

                _claimlast2NAF3 = refothers.NOCLast2Claim3NotAtFault;
                _claimlast2AF3 = refothers.NOCLast2Claim3AtFault;
                _claimlast2Windscreen3 = refothers.NOCLast2Claim3Windscreen;
                _claimlast2AccidentDate3 = refothers.NOCLast2Claim3AccidentDate;

                _noofclaimlast1 = refothers.NOCLast1.ToString();
                _claimlast1NAF1 = refothers.NOCLast1Claim1NotAtFault;
                _claimlast1AF1 = refothers.NOCLast1Claim1AtFault;
                _claimlast1Windscreen1 = refothers.NOCLast1Claim1Windscreen;
                _claimlast1AccidentDate1 = refothers.NOCLast1Claim1AccidentDate;

                _claimlast1NAF2 = refothers.NOCLast1Claim2NotAtFault;
                _claimlast1AF2 = refothers.NOCLast1Claim2AtFault;
                _claimlast1Windscreen2 = refothers.NOCLast1Claim2Windscreen;
                _claimlast1AccidentDate2 = refothers.NOCLast1Claim2AccidentDate;

                _claimlast1NAF3 = refothers.NOCLast1Claim3NotAtFault;
                _claimlast1AF3 = refothers.NOCLast1Claim3AtFault;
                _claimlast1Windscreen3 = refothers.NOCLast1Claim3Windscreen;
                _claimlast1AccidentDate3 = refothers.NOCLast1Claim3AccidentDate;

                if (refothers.SuspensionOfLicense)
                {
                    _suspension = "Yes";
                }
                else
                {
                    _suspension = "No";
                }

                if (refothers.PolicyCancelled)
                {
                    _policycancelled = "Yes";
                }
                else
                {
                    _policycancelled = "No";
                }

                _renewalquote = refothers.RenewalQuoteReceived.ToString();

                _driver1relation = refothers.Driver1Relation;
                _driver1name = refothers.Driver1Name;
                _driver1nric = refothers.Driver1NRIC;
                _driver1licensepassdate = refothers.Driver1LicensePassDate;

                _driver2relation = refothers.Driver2Relation;
                _driver2name = refothers.Driver2Name;
                _driver2nric = refothers.Driver2NRIC;
                _driver2licensepassdate = refothers.Driver2LicensePassDate;

                _driver3relation = refothers.Driver3Relation;
                _driver3name = refothers.Driver3Name;
                _driver3nric = refothers.Driver3NRIC;
                _driver3licensepassdate = refothers.Driver3LicensePassDate;

                _driver4relation = refothers.Driver4Relation;
                _driver4name = refothers.Driver4Name;
                _driver4nric = refothers.Driver4NRIC;
                _driver4licensepassdate = refothers.Driver4LicensePassDate;

                _driver5relation = refothers.Driver5Relation;
                _driver5name = refothers.Driver5Name;
                _driver5nric = refothers.Driver5NRIC;
                _driver5licensepassdate = refothers.Driver5LicensePassDate;

            }

            #endregion

            #region Html
            _html = "<table><tr><td colspan='4'> </td></tr></table>";

            _html += "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"
                     + "<tr>"
                     + "<td width='50%'>" //Start 1
                     + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Name</td>"
                     + "<td width='50%' align='left'>" + _name.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Marital Status</td>"
                     + "<td width='50%' align='left'>" + _maritalstatus.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Occupation / Business</td>"
                     + "<td width='50%' align='left'>" + _occupation.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Mobile No</td>"
                     + "<td width='50%' align='left'>" + _mobile.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>NRIC</td>"
                     + "<td width='50%' align='left'>" + _nric.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Car MakeModel</td>"
                     + "<td width='50%' align='left'>" + _carmodel.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Car Manufacture Year</td>"
                     + "<td width='50%' align='left'>" + _manufactureyear.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Existing NCD</td>"
                     + "<td width='50%' align='left'>" + _ncdpercent.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Off Peak</td>"
                     + "<td width='50%' align='left'>" + _offpeek.ToString() + "</td>"
                     + "</tr>"



                     + "</table>"
                     + "</td>" //End 1

                     + "<td width='50%'>" //Start 2
                     + "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Date of Birth</td>"
                     + "<td width='50%' style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _dob.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Gender</td>"
                     + "<td width='50%' align='left'>" + _gender.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Email</td>"
                     + "<td width='50%' align='left'>" + _email.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Driving Experience</td>"
                     + "<td width='50%' align='left'>" + _yearsofdriving.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Commencement Date</td>"
                     + "<td width='50%' style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _insdate.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Vehicle No</td>"
                     + "<td width='50%' align='left'>" + _vehicleno.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Register Year</td>"
                     + "<td width='50%' align='left'>" + _registeryear.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>NCD on next renewal (%)</td>"
                     + "<td width='50%' align='left'>" + _applicablencd.ToString() + "</td>"
                     + "</tr>"

                     + "<tr>"
                     + "<td width='50%' align='left'>Offence-Free Driving</td>"
                     + "<td width='50%' align='left'>" + _offancedriving.ToString() + "</td>"
                     + "</tr>"

                     + "</table>"
                     + "</td>" //End 2
                     + "</tr>";

            _html += "</table>";

            _html += "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>";
            _html += "<tr><td colspan='4' align='left'><b>Driving License Pass Date: </b>" + _drivinglicensepass.ToString("dd-MMM-yyyy") + "</td></tr>";
            _html += "</table>";

            _html += "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>";
            _html += "<tr><td colspan='4' align='left'><b>Any Suspension of Driving License? </b>" + _suspension + "</td></tr>";
            _html += "</table>";

            _html += "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>";
            _html += "<tr><td colspan='4' align='left'><b> Any motor policy cancelled or declined for renewal by insurers? </b>" + _policycancelled + "</td></tr>";
            _html += "</table>";

            _html += "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>";
            _html += "<tr><td colspan='4' align='left'><b>Current Insurer : </b>" + _inscomp.ToString() + "</td></tr>";
            _html += "</table>";

            _html += "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>";
            _html += "<tr><td colspan='4' align='left'><b>Cover Type : </b>" + _covertypedesc.ToString() + " " + _info2.ToString() + "</td></tr>";
            _html += "</table>";

            _html += "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>";
            _html += "<tr><td colspan='4' align='left'><b>Renewal Quote Received : </b>S$" + _renewalquote.ToString() + "</td></tr>";
            _html += "</table>";

            _html += "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>";
            _html += "<tr><td colspan='4' align='left'><b>Most Important to you : </b>" + _info3.ToString() + "</td></tr>";
            _html += "</table>";

            _html += "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>";

            _html += "<tr><td colspan='4' align='left'><b>Any Claims in the Last 3 Years? : </b>" + _claimstatus.ToString() + "</td></tr>";
            if (_claimstatus == "Yes")
            {
                if (claimamt1.ToString() != "0")
                {
                    _html += "<tr><td style='width:25%' align='left'>Claim Date</td>"
                    + "<td style='width:25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'> " + _claim1ststat.ToString() + " to " + _claim1stend.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'> Claim Amount</td>"
                    + "<td style='width: 25%' align='left'>" + claimamt1.ToString() + "</td></tr>";

                    if (_noofclaimlast1 == "1")
                    {
                        _html += "<tr><td align='left' colspan='4'>Claim 1</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Not At Fault</td>"
                        + "<td style='width: 25%'  align='left'> " + _claimlast1NAF1 + "</td>"
                        + "<td style='width: 25%' align='left'>At Fault</td>"
                        + "<td style='width: 25%' align='left'>" + _claimlast1AF1 + "</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Windscreen</td>"
                        + "<td style='width: 25%' align='left'> " + _claimlast1Windscreen1 + "</td>"
                        + "<td style='width: 25%' align='left'>Accident Date</td>"
                        + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claimlast1AccidentDate1.ToString("dd/MMM/yyyy") + "</td></tr>";

                    }

                    if (_noofclaimlast1 == "2")
                    {
                        _html += "<tr><td align='left' colspan='4'>Claim 1</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Not At Fault</td>"
                        + "<td style='width: 25%'  align='left'> " + _claimlast1NAF1 + "</td>"
                        + "<td style='width: 25%' align='left'>At Fault</td>"
                        + "<td style='width: 25%' align='left'>" + _claimlast1AF1 + "</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Windscreen</td>"
                        + "<td style='width: 25%' align='left'> " + _claimlast1Windscreen1 + "</td>"
                        + "<td style='width: 25%' align='left'>Accident Date</td>"
                        + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claimlast1AccidentDate1.ToString("dd/MMM/yyyy") + "</td></tr>";


                        _html += "<tr><td align='left' colspan='4'>Claim 2</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Not At Fault</td>"
                        + "<td style='width: 25%'  align='left'> " + _claimlast1NAF2 + "</td>"
                        + "<td style='width: 25%' align='left'>At Fault</td>"
                        + "<td style='width: 25%' align='left'>" + _claimlast1AF2 + "</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Windscreen</td>"
                        + "<td style='width: 25%' align='left'> " + _claimlast1Windscreen2 + "</td>"
                        + "<td style='width: 25%' align='left'>Accident Date</td>"
                        + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claimlast1AccidentDate2.ToString("dd/MMM/yyyy") + "</td></tr>";

                    }

                    if (_noofclaimlast1 == "3")
                    {
                        _html += "<tr><td align='left' colspan='4'>Claim 1</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Not At Fault</td>"
                        + "<td style='width: 25%'  align='left'> " + _claimlast1NAF1 + "</td>"
                        + "<td style='width: 25%' align='left'>At Fault</td>"
                        + "<td style='width: 25%' align='left'>" + _claimlast1AF1 + "</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Windscreen</td>"
                        + "<td style='width: 25%' align='left'> " + _claimlast1Windscreen1 + "</td>"
                        + "<td style='width: 25%' align='left'>Accident Date</td>"
                        + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claimlast1AccidentDate1.ToString("dd/MMM/yyyy") + "</td></tr>";


                        _html += "<tr><td align='left' colspan='4'>Claim 2</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Not At Fault</td>"
                        + "<td style='width: 25%'  align='left'> " + _claimlast1NAF2 + "</td>"
                        + "<td style='width: 25%' align='left'>At Fault</td>"
                        + "<td style='width: 25%' align='left'>" + _claimlast1AF2 + "</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Windscreen</td>"
                        + "<td style='width: 25%' align='left'> " + _claimlast1Windscreen2 + "</td>"
                        + "<td style='width: 25%' align='left'>Accident Date</td>"
                        + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claimlast1AccidentDate2.ToString("dd/MMM/yyyy") + "</td></tr>";

                        _html += "<tr><td align='left' colspan='4'>Claim 3</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Not At Fault</td>"
                        + "<td style='width: 25%'  align='left'> " + _claimlast1NAF3 + "</td>"
                        + "<td style='width: 25%' align='left'>At Fault</td>"
                        + "<td style='width: 25%' align='left'>" + _claimlast1AF3 + "</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Windscreen</td>"
                        + "<td style='width: 25%' align='left'> " + _claimlast1Windscreen3 + "</td>"
                        + "<td style='width: 25%' align='left'>Accident Date</td>"
                        + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claimlast1AccidentDate3.ToString("dd/MMM/yyyy") + "</td></tr>";

                    }

                }
                if (claimamt2.ToString() != "0")
                {
                    _html += "<tr><td style='width:25%' align='left'>Claim Date</td>"
                    + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claim2ndstat.ToString() + " to " + _claim2ndend.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'> Claim Amount</td>"
                    + "<td style='width: 25%' align='left'>" + claimamt2.ToString() + "</td></tr>";

                    if (_noofclaimlast2 == "1")
                    {
                        _html += "<tr><td align='left' colspan='4'>Claim 1</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Not At Fault</td>"
                        + "<td style='width: 25%'  align='left'> " + _claimlast2NAF1 + "</td>"
                        + "<td style='width: 25%' align='left'>At Fault</td>"
                        + "<td style='width: 25%' align='left'>" + _claimlast2AF1 + "</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Windscreen</td>"
                        + "<td style='width: 25%' align='left'> " + _claimlast2Windscreen1 + "</td>"
                        + "<td style='width: 25%' align='left'>Accident Date</td>"
                        + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claimlast2AccidentDate1.ToString("dd/MMM/yyyy") + "</td></tr>";

                    }

                    if (_noofclaimlast2 == "2")
                    {
                        _html += "<tr><td align='left' colspan='4'>Claim 1</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Not At Fault</td>"
                        + "<td style='width: 25%'  align='left'> " + _claimlast2NAF1 + "</td>"
                        + "<td style='width: 25%' align='left'>At Fault</td>"
                        + "<td style='width: 25%' align='left'>" + _claimlast2AF1 + "</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Windscreen</td>"
                        + "<td style='width: 25%' align='left'> " + _claimlast2Windscreen1 + "</td>"
                        + "<td style='width: 25%' align='left'>Accident Date</td>"
                        + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claimlast2AccidentDate1.ToString("dd/MMM/yyyy") + "</td></tr>";

                        _html += "<tr><td align='left' colspan='4'>Claim 2</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Not At Fault</td>"
                        + "<td style='width: 25%'  align='left'> " + _claimlast2NAF2 + "</td>"
                        + "<td style='width: 25%' align='left'>At Fault</td>"
                        + "<td style='width: 25%' align='left'>" + _claimlast2AF2 + "</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Windscreen</td>"
                        + "<td style='width: 25%' align='left'> " + _claimlast2Windscreen2 + "</td>"
                        + "<td style='width: 25%' align='left'>Accident Date</td>"
                        + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claimlast2AccidentDate2.ToString("dd/MMM/yyyy") + "</td></tr>";

                    }

                    if (_noofclaimlast2 == "3")
                    {
                        _html += "<tr><td align='left' colspan='4'>Claim 1</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Not At Fault</td>"
                        + "<td style='width: 25%' align='left'> " + _claimlast2NAF1 + "</td>"
                        + "<td style='width: 25%' align='left'>At Fault</td>"
                        + "<td style='width: 25%' align='left'>" + _claimlast2AF1 + "</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Windscreen</td>"
                        + "<td style='width: 25%' align='left'> " + _claimlast2Windscreen1 + "</td>"
                        + "<td style='width: 25%' align='left'>Accident Date</td>"
                        + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claimlast2AccidentDate1.ToString("dd/MMM/yyyy") + "</td></tr>";

                        _html += "<tr><td align='left' colspan='4'>Claim 2</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Not At Fault</td>"
                        + "<td style='width: 25%'  align='left'> " + _claimlast2NAF2 + "</td>"
                        + "<td style='width: 25%' align='left'>At Fault</td>"
                        + "<td style='width: 25%' align='left'>" + _claimlast2AF2 + "</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Windscreen</td>"
                        + "<td style='width: 25%' align='left'> " + _claimlast2Windscreen2 + "</td>"
                        + "<td style='width: 25%' align='left'>Accident Date</td>"
                        + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claimlast2AccidentDate2.ToString("dd/MMM/yyyy") + "</td></tr>";

                        _html += "<tr><td align='left' colspan='4'>Claim 3</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Not At Fault</td>"
                        + "<td style='width: 25%'  align='left'> " + _claimlast2NAF3 + "</td>"
                        + "<td style='width: 25%' align='left'>At Fault</td>"
                        + "<td style='width: 25%' align='left'>" + _claimlast2AF3 + "</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Windscreen</td>"
                        + "<td style='width: 25%' align='left'> " + _claimlast2Windscreen3 + "</td>"
                        + "<td style='width: 25%' align='left'>Accident Date</td>"
                        + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claimlast2AccidentDate3.ToString("dd/MMM/yyyy") + "</td></tr>";

                    }
                }
                if (claimamt3.ToString() != "0")
                {
                    _html += "<tr><td style='width:25%' align='left'>Claim Date</td>"
                    + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claim3rdstat.ToString() + " to " + _claim3rdend.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'> Claim Amount</td>"
                    + "<td style='width: 25%' align='left'>" + claimamt3.ToString() + "</td></tr>";

                    if (_noofclaimlast3 == "1")
                    {
                        _html += "<tr><td align='left' colspan='4'>Claim 1</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Not At Fault</td>"
                        + "<td style='width: 25%'  align='left'> " + _claimlast3NAF1 + "</td>"
                        + "<td style='width: 25%' align='left'>At Fault</td>"
                        + "<td style='width: 25%' align='left'>" + _claimlast3AF1 + "</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Windscreen</td>"
                        + "<td style='width: 25%' align='left'> " + _claimlast3Windscreen1 + "</td>"
                        + "<td style='width: 25%' align='left'>Accident Date</td>"
                        + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claimlast3AccidentDate1.ToString("dd/MMM/yyyy") + "</td></tr>";

                    }

                    if (_noofclaimlast3 == "2")
                    {
                        _html += "<tr><td align='left' colspan='4'>Claim 1</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Not At Fault</td>"
                        + "<td style='width: 25%'  align='left'> " + _claimlast3NAF1 + "</td>"
                        + "<td style='width: 25%' align='left'>At Fault</td>"
                        + "<td style='width: 25%' align='left'>" + _claimlast3AF1 + "</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Windscreen</td>"
                        + "<td style='width: 25%' align='left'> " + _claimlast3Windscreen1 + "</td>"
                        + "<td style='width: 25%' align='left'>Accident Date</td>"
                        + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claimlast3AccidentDate1.ToString("dd/MMM/yyyy") + "</td></tr>";

                        _html += "<tr><td align='left' colspan='4'>Claim 2</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Not At Fault</td>"
                        + "<td style='width: 25%' align='left'> " + _claimlast3NAF2 + "</td>"
                        + "<td style='width: 25%' align='left'>At Fault</td>"
                        + "<td style='width: 25%' align='left'>" + _claimlast3AF2 + "</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Windscreen</td>"
                        + "<td style='width: 25%' align='left'> " + _claimlast3Windscreen2 + "</td>"
                        + "<td style='width: 25%' align='left'>Accident Date</td>"
                        + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claimlast3AccidentDate2.ToString("dd/MMM/yyyy") + "</td></tr>";

                    }

                    if (_noofclaimlast3 == "3")
                    {
                        _html += "<tr><td align='left' colspan='4'>Claim 1</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Not At Fault</td>"
                        + "<td style='width: 25%'  align='left'> " + _claimlast3NAF1 + "</td>"
                        + "<td style='width: 25%' align='left'>At Fault</td>"
                        + "<td style='width: 25%' align='left'>" + _claimlast3AF1 + "</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Windscreen</td>"
                        + "<td style='width: 25%' align='left'> " + _claimlast3Windscreen1 + "</td>"
                        + "<td style='width: 25%' align='left'>Accident Date</td>"
                        + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claimlast3AccidentDate1.ToString("dd/MMM/yyyy") + "</td></tr>";

                        _html += "<tr><td align='left' colspan='4'>Claim 2</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Not At Fault</td>"
                        + "<td style='width: 25%'  align='left'> " + _claimlast3NAF2 + "</td>"
                        + "<td style='width: 25%' align='left'>At Fault</td>"
                        + "<td style='width: 25%' align='left'>" + _claimlast3AF2 + "</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Windscreen</td>"
                        + "<td style='width: 25%' align='left'> " + _claimlast3Windscreen2 + "</td>"
                        + "<td style='width: 25%' align='left'>Accident Date</td>"
                        + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claimlast3AccidentDate2.ToString("dd/MMM/yyyy") + "</td></tr>";

                        _html += "<tr><td align='left' colspan='4'>Claim 3</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Not At Fault</td>"
                        + "<td style='width: 25%'  align='left'> " + _claimlast3NAF3 + "</td>"
                        + "<td style='width: 25%' align='left'>At Fault</td>"
                        + "<td style='width: 25%' align='left'>" + _claimlast3AF3 + "</td></tr>";

                        _html += "<tr><td style='width:25%' align='left'>Windscreen</td>"
                        + "<td style='width: 25%' align='left'> " + _claimlast3Windscreen3 + "</td>"
                        + "<td style='width: 25%' align='left'>Accident Date</td>"
                        + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _claimlast3AccidentDate3.ToString("dd/MMM/yyyy") + "</td></tr>";

                    }
                }
            }

            _html += "</table>";

            _html += "<table style='width: 100%; background-color: white;' cellpadding='0' cellspacing='0' border='1'>";
            _html += "<tr><td colspan='4' align='left'><b>Additional drivers : </b>" + _additionaldriver.ToString() + "</td></tr>";
            if (_additionaldriver == "Yes")
            {
                if (Convert.ToInt16(_drcount) > 0)
                {

                    _html += "<tr><td colspan='4' align='left'>Driver 1</td></tr>"
                    + "<tr><td style='width:25%' align='left'>Name</td>"
                    + "<td style='width: 25%' align='left'>" + _driver1name + "</td>"
                    + "<td style='width: 25%' align='left'>Relation </td>"
                    + "<td style='width: 25%' align='left'> " + _driver1relation + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>NRIC</td>"
                    + "<td style='width: 25%' align='left'>" + _driver1nric + "</td>"
                    + "<td style='width: 25%' align='left'>License Pass Date </td>"
                    + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'> " + _driver1licensepassdate.ToString("dd/MMM/yyyy") + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>Driver DOB</td>"
                    + "<td style='width: 25%' style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _drDOB1.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Driving Experience</td>"
                    + "<td style='width: 25%' align='left'>" + _drexp1.ToString() + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>Gender</td>"
                    + "<td style='width: 25%' align='left'>" + _drgender1.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Marital Status</td>"
                    + "<td style='width: 25%' align='left'>" + _drmarital1.ToString() + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>Occupation</td>"
                    + "<td style='width: 25%' align='left'>" + _drocc1.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Job Nature</td>"
                    + "<td style='width: 25%' align='left'>" + _drjobnature1.ToString() + "</td></tr>";


                }
                if (Convert.ToInt16(_drcount) > 1)
                {
                    _html += "<tr><td colspan='4' align='left'>Driver 2</td></tr>"
                    + "<tr><td style='width:25%' align='left'>Name</td>"
                    + "<td style='width: 25%' align='left'>" + _driver2name + "</td>"
                    + "<td style='width: 25%' align='left'>Relation </td>"
                    + "<td style='width: 25%' align='left'> " + _driver2relation + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>NRIC</td>"
                    + "<td style='width: 25%' align='left'>" + _driver2nric + "</td>"
                    + "<td style='width: 25%' align='left'>License Pass Date </td>"
                    + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'> " + _driver2licensepassdate.ToString("dd/MMM/yyyy") + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>Driver DOB</td>"
                    + "<td style='width: 25%' style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _drDOB2.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Driving Experience</td>"
                    + "<td style='width: 25%' align='left'>" + _drexp2.ToString() + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>Gender</td>"
                    + "<td style='width: 25%' align='left'>" + _drgender2.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Marital Status</td>"
                    + "<td style='width: 25%' align='left'>" + _drmarital2.ToString() + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>Occupation</td>"
                    + "<td style='width: 25%' align='left'>" + _drocc2.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Job Nature</td>"
                    + "<td style='width: 25%' align='left'>" + _drjobnature2.ToString() + "</td></tr>";
                }
                if (Convert.ToInt16(_drcount) > 2)
                {
                    _html += "<tr><td colspan='4' align='left'>Driver 3</td></tr>"
                    + "<tr><td style='width:25%' align='left'>Name</td>"
                    + "<td style='width: 25%' align='left'>" + _driver3name + "</td>"
                    + "<td style='width: 25%' align='left'>Relation </td>"
                    + "<td style='width: 25%' align='left'> " + _driver3relation + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>NRIC</td>"
                    + "<td style='width: 25%' align='left'>" + _driver3nric + "</td>"
                    + "<td style='width: 25%' align='left'>License Pass Date </td>"
                    + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'> " + _driver3licensepassdate.ToString("dd/MMM/yyyy") + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>Driver DOB</td>"
                    + "<td style='width: 25%' style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _drDOB3.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Driving Experience</td>"
                    + "<td style='width: 25%' align='left'>" + _drexp3.ToString() + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>Gender</td>"
                    + "<td style='width: 25%' align='left'>" + _drgender3.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Marital Status</td>"
                    + "<td style='width: 25%' align='left'>" + _drmarital3.ToString() + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>Occupation</td>"
                    + "<td style='width: 25%' align='left'>" + _drocc3.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Job Nature</td>"
                    + "<td style='width: 25%' align='left'>" + _drjobnature3.ToString() + "</td></tr>";
                }
                if (Convert.ToInt16(_drcount) > 3)
                {
                    _html += "<tr><td colspan='4' align='left'>Driver 4</td></tr>"
                    + "<tr><td style='width:25%' align='left'>Name</td>"
                    + "<td style='width: 25%' align='left'>" + _driver4name + "</td>"
                    + "<td style='width: 25%' align='left'>Relation </td>"
                    + "<td style='width: 25%' align='left'> " + _driver4relation + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>NRIC</td>"
                    + "<td style='width: 25%' align='left'>" + _driver4nric + "</td>"
                    + "<td style='width: 25%' align='left'>License Pass Date </td>"
                    + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'> " + _driver4licensepassdate.ToString("dd/MMM/yyyy") + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>Driver DOB</td>"
                    + "<td style='width: 25%' style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _drDOB4 + "</td>"
                    + "<td style='width: 25%' align='left'>Driving Experience</td>"
                    + "<td style='width: 25%' align='left'>" + _drexp4.ToString() + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>Gender</td>"
                    + "<td style='width: 25%' align='left'>" + _drgender4.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Marital Status</td>"
                    + "<td style='width: 25%' align='left'>" + _drmarital4.ToString() + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>Occupation</td>"
                    + "<td style='width: 25%' align='left'>" + _drocc4.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Job Nature</td>"
                    + "<td style='width: 25%' align='left'>" + _drjobnature4.ToString() + "</td></tr>";
                }
                if (Convert.ToInt16(_drcount) > 4)
                {
                    _html += "<tr><td colspan='4' align='left'>Driver 5</td></tr>"
                    + "<tr><td style='width:25%' align='left'>Name</td>"
                    + "<td style='width: 25%' align='left'>" + _driver5name + "</td>"
                    + "<td style='width: 25%' align='left'>Relation </td>"
                    + "<td style='width: 25%' align='left'> " + _driver5relation + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>NRIC</td>"
                    + "<td style='width: 25%' align='left'>" + _driver5nric + "</td>"
                    + "<td style='width: 25%' align='left'>License Pass Date </td>"
                    + "<td style='width: 25%; mso-number-format:dd\\-mmm\\-yyyy' align='left'> " + _driver5licensepassdate.ToString("dd/MMM/yyyy") + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>Driver DOB</td>"
                    + "<td style='width: 25%' style='mso-number-format:dd\\-mmm\\-yyyy' align='left'>" + _drDOB5 + "</td>"
                    + "<td style='width: 25%' align='left'>Driving Experience</td>"
                    + "<td style='width: 25%' align='left'>" + _drexp5.ToString() + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>Gender</td>"
                    + "<td style='width: 25%' align='left'>" + _drgender5.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Marital Status</td>"
                    + "<td style='width: 25%' align='left'>" + _drmarital5.ToString() + "</td></tr>"

                    + "<tr><td style='width:25%' align='left'>Occupation</td>"
                    + "<td style='width: 25%' align='left'>" + _drocc5.ToString() + "</td>"
                    + "<td style='width: 25%' align='left'>Job Nature</td>"
                    + "<td style='width: 25%' align='left'>" + _drjobnature5.ToString() + "</td></tr>";
                }
            }
            _html += "</table>";
            _html += "</table>";
            #endregion

            lblContent.Text = _html;
            MyIO myio = new MyIO();
            //_fileName = Session[General.CarId].ToString() + "_" + CE.Global.General.GetUTCDateTime().ToString("yyyyMMMdd");
            string[] filecontent = new string[1];
            filecontent[0] = strText + lblContent.Text.ToString();
            myio.WriteNewFile(FilePath, FileName, filecontent);
            //myio.WriteNewFile(GetFilePath(), _fileName + ".xls", filecontent);
            string[] filelist = new string[1];
            filelist[0] = FilePath + FileName;

            //Sakthi on 27 Jan 2011 -- Start
            //string _Email = CE.Configuration.MyConfigurationManager.GetAppSettingValue("CINMF_TO");
            //string _CCEmail = CE.Configuration.MyConfigurationManager.GetAppSettingValue("CINMF_CC");
            //string _BCCEmail = CE.Configuration.MyConfigurationManager.GetAppSettingValue("CINMF_BCC");

            //string convertno = General.GetRefNumber(Convert.ToInt64(Session[General.CarId].ToString()));
            //string _RefNo = "NSCI" + convertno.ToString();

            //string _strSql = "";
            //string _Date = "";
            //string _Time = "";
            //MyDatabase _db = new MyDatabase();
            //_strSql = "SELECT TOP 1 CONVERT(VARCHAR,ModifiedDate,103) AS [Date], CONVERT(VARCHAR,ModifiedDate,108) AS [Time] ";
            //_strSql += "FROM tblReferenceCEUser WHERE ProductId = " + Session[General.CarId].ToString() + "  AND ProductType = 'CI' ORDER BY ModifiedDate DESC";
            //DataTable _dtDateTime = _db.GetDataTable(_strSql);
            //if (_dtDateTime.Rows.Count > 0)
            //{
            //    _Date = _dtDateTime.Rows[0]["Date"].ToString();
            //    _Time = _dtDateTime.Rows[0]["Time"].ToString();
            //}

            //MyMailManager.SendCINoMatchFountAttachment(_Email, _CCEmail, _BCCEmail, _RefNo.ToString(), _Date, _Time, filelist);
            //Sakthi on 27 Jan 2011 -- End

        }

    }

    private bool GetReferenceUser(Int64 UserId, Int64 CarId, string ProductType)
    {
        bool isSubmitted = false;
        divCarMenu.Visible = false;        
        divFormSelection.Visible = false;

        if (Request.UrlReferrer != null)
        {
            if (Request.UrlReferrer.AbsolutePath.ToString().ToLower() == "/user/viewresulthistory.aspx")
            {
                btnOfflineBack.Visible = false;
            }
        }

        //user/viewresulthistory.aspx

        ReferenceUser _referenceuser = new ReferenceUser();
        ReferenceUserDB _referenceuserdb = new ReferenceUserDB();
        _referenceuser = _referenceuserdb.GetReferenceUser(UserId, CarId, ProductType);

        if (_referenceuser != null)
        {
            isSubmitted = true;
            btnOfflineBack.Visible = false;
            txtFullName.Text = _referenceuser.FullName;
            ddlIdNumber.Prefix = _referenceuser.NRIC.ToString().Substring(0, 1);
            ddlIdNumber.Postfix = _referenceuser.NRIC.ToString().Substring(8, 1);
            ddlIdNumber.IDNumber = _referenceuser.NRIC.ToString().Substring(1, 7);
            txtVehicleNo.Text = _referenceuser.VehicleNumber;
            txtMobileNo.PhoneNo = _referenceuser.MobileNumber;
            txtEmail.Text = _referenceuser.Email;
            lblNoMatchMessage.Text = "Already Submitted on " + String.Format("{0:dd/MMM/yyyy hh:mm tt}", _referenceuser.ModifiedDate);
            ddlNoMatchCoverType.Text = _referenceuser.ProviderCoverTypeId.ToString();
            txtFullName.ReadOnly = true;
            txtVehicleNo.ReadOnly = true;
            txtEmail.ReadOnly = true;
            btnSubmit.Visible = false;
            divNoMatchMessage.Visible = true;
            ibtRunNewQuoteforNomatch.Visible = false;

            if (_referenceuser.Info2 != null && _referenceuser.Info2 != "")
            {
                lblComprehensiveDetails.Text = " " + _referenceuser.Info2;

            }

            if (_referenceuser.Info3 != null && _referenceuser.Info3 != "")
            {
                ddlImportant.Text = _referenceuser.Info3;
            }

            GetReferenceUserOtherDetails(UserId, CarId, _referenceuser.UserId);

            //disable controls
            ddlIdNumber.IsEnabled = false;
            usrDrivingLicenseDate.IsEnabled = false;
            ddlNoMatchCoverType.Enabled = false;
            ddlImportant.Enabled = false;

            rdoSuspensionNo.Enabled = false;
            rdoSuspensionYes.Enabled = false;
            rdoCancelledNo.Enabled = false;
            rdoCancelledYes.Enabled = false;
            txtMobileNo.IsEnabled = false;
            txtRenewalQuoteReceived.Enabled = false;

            txtClaimLast1AF1.Enabled = false;
            txtClaimLast1AF2.Enabled = false;
            txtClaimLast1AF3.Enabled = false;
            txtClaimLast1NAF1.Enabled = false;
            txtClaimLast1NAF2.Enabled = false;
            txtClaimLast1NAF3.Enabled = false;
            txtClaimLast1Windscreen1.Enabled = false;
            txtClaimLast1Windscreen2.Enabled = false;
            txtClaimLast1Windscreen3.Enabled = false;
            txtClaimLast2AF1.Enabled = false;
            txtClaimLast2AF2.Enabled = false;
            txtClaimLast2AF3.Enabled = false;
            txtClaimLast2NAF1.Enabled = false;
            txtClaimLast2NAF2.Enabled = false;
            txtClaimLast2NAF3.Enabled = false;
            txtClaimLast2Windscreen1.Enabled = false;
            txtClaimLast2Windscreen2.Enabled = false;
            txtClaimLast2Windscreen3.Enabled = false;
            txtClaimLast3AF1.Enabled = false;
            txtClaimLast3AF2.Enabled = false;
            txtClaimLast3AF3.Enabled = false;
            txtClaimLast3NAF1.Enabled = false;
            txtClaimLast3NAF2.Enabled = false;
            txtClaimLast3NAF3.Enabled = false;
            txtClaimLast3Windscreen1.Enabled = false;
            txtClaimLast3Windscreen2.Enabled = false;
            txtClaimLast3Windscreen3.Enabled = false;

            usrClaimLast1AccidentDate1.IsEnabled = false;
            usrClaimLast1AccidentDate2.IsEnabled = false;
            usrClaimLast1AccidentDate3.IsEnabled = false;
            usrClaimLast2AccidentDate1.IsEnabled = false;
            usrClaimLast2AccidentDate2.IsEnabled = false;
            usrClaimLast2AccidentDate3.IsEnabled = false;
            usrClaimLast3AccidentDate1.IsEnabled = false;
            usrClaimLast3AccidentDate2.IsEnabled = false;
            usrClaimLast3AccidentDate3.IsEnabled = false;

            txtDriver1Relation.Enabled = false;
            txtDriver1Name.Enabled = false;
            usrDriver1NRIC.IsEnabled = false;
            usrDriver1LicensePassDate.IsEnabled = false;

            txtDriver2Relation.Enabled = false;
            txtDriver2Name.Enabled = false;
            usrDriver2NRIC.IsEnabled = false;
            usrDriver2LicensePassDate.IsEnabled = false;

            txtDriver3Relation.Enabled = false;
            txtDriver3Name.Enabled = false;
            usrDriver3NRIC.IsEnabled = false;
            usrDriver3LicensePassDate.IsEnabled = false;

            txtDriver4Relation.Enabled = false;
            txtDriver4Name.Enabled = false;
            usrDriver4NRIC.IsEnabled = false;
            usrDriver4LicensePassDate.IsEnabled = false;

            txtDriver5Relation.Enabled = false;
            txtDriver5Name.Enabled = false;
            usrDriver5NRIC.IsEnabled = false;
            usrDriver5LicensePassDate.IsEnabled = false;

        }
        else
        {
            txtFullName.ReadOnly = false;
            txtVehicleNo.ReadOnly = false;
            txtEmail.ReadOnly = true;
            if (CheckCommencementDateExpiry(UserId, CarId))
            {
                btnSubmit.Visible = true;
                lblNoMatchMessage.Text = "";
                divNoMatchMessage.Visible = false;
                ibtRunNewQuoteforNomatch.Visible = false;
            }
            else
            {
                btnSubmit.Visible = false;
                lblNoMatchMessage.Text = "Commencement Date already Expired. Please Run New Quote.";
                divNoMatchMessage.Visible = true;
                ibtRunNewQuoteforNomatch.Visible = true;
                btnOfflineBack.Visible = false;
                DisableControls();
            }
            txtFullName.Text = Session[General.UserName].ToString();
            txtMobileNo.PhoneNo = Session[General.UserPhoneNo].ToString();
            txtEmail.Text = Session[General.UserEmail].ToString();
            //Contact _contact = new Contact();
            //ContactDB _contactdb = new ContactDB();
            //_contact = _contactdb.GetContact(UserId);

            //if (_contact != null)
            //{
            //    txtEmail.Text = _contact.Email;
            //    txtEmail.ReadOnly = true;
            //}


            CheckClaimAndDriverDetails(CarId, UserId);
        }

        return isSubmitted;
    }

    private void GetReferenceUserOtherDetails(Int64 RefCEUserId, Int64 CarId, Int64 UserId)
    {
        ReferenceUserOtherDetails _referenceuserothers = new ReferenceUserOtherDetails();
        ReferenceUserOtherDetailsDB _referenceuserothersdb = new ReferenceUserOtherDetailsDB();

        _referenceuserothers = _referenceuserothersdb.GetReferenceUserOtherDetails(RefCEUserId, CarId, UserId);

        if (_referenceuserothers != null)
        {
            usrDrivingLicenseDate.Day = _referenceuserothers.DrivingLicensePassDate.Day;
            usrDrivingLicenseDate.Month = _referenceuserothers.DrivingLicensePassDate.Month;
            usrDrivingLicenseDate.Year = _referenceuserothers.DrivingLicensePassDate.Year;

            if (_referenceuserothers.SuspensionOfLicense)
            {
                rdoSuspensionYes.Checked = true;
            }
            else
            {
                rdoSuspensionNo.Checked = true;
            }

            if (_referenceuserothers.PolicyCancelled)
            {
                rdoCancelledYes.Checked = true;
            }
            else
            {
                rdoCancelledNo.Checked = true;
            }


            txtClaimLast3NAF1.Text = _referenceuserothers.NOCLast3Claim1NotAtFault;
            txtClaimLast3AF1.Text = _referenceuserothers.NOCLast3Claim1AtFault;
            txtClaimLast3Windscreen1.Text = _referenceuserothers.NOCLast3Claim1Windscreen;
            usrClaimLast3AccidentDate1.Day = _referenceuserothers.NOCLast3Claim1AccidentDate.Day;
            usrClaimLast3AccidentDate1.Month = _referenceuserothers.NOCLast3Claim1AccidentDate.Month;
            usrClaimLast3AccidentDate1.Year = _referenceuserothers.NOCLast3Claim1AccidentDate.Year;

            txtClaimLast3NAF2.Text = _referenceuserothers.NOCLast3Claim2NotAtFault;
            txtClaimLast3AF2.Text = _referenceuserothers.NOCLast3Claim2AtFault;
            txtClaimLast3Windscreen2.Text = _referenceuserothers.NOCLast3Claim2Windscreen;
            usrClaimLast3AccidentDate2.Day = _referenceuserothers.NOCLast3Claim2AccidentDate.Day;
            usrClaimLast3AccidentDate2.Month = _referenceuserothers.NOCLast3Claim2AccidentDate.Month;
            usrClaimLast3AccidentDate2.Year = _referenceuserothers.NOCLast3Claim2AccidentDate.Year;

            txtClaimLast3NAF3.Text = _referenceuserothers.NOCLast3Claim3NotAtFault;
            txtClaimLast3AF3.Text = _referenceuserothers.NOCLast3Claim3AtFault;
            txtClaimLast3Windscreen3.Text = _referenceuserothers.NOCLast3Claim3Windscreen;
            usrClaimLast3AccidentDate3.Day = _referenceuserothers.NOCLast3Claim3AccidentDate.Day;
            usrClaimLast3AccidentDate3.Month = _referenceuserothers.NOCLast3Claim3AccidentDate.Month;
            usrClaimLast3AccidentDate3.Year = _referenceuserothers.NOCLast3Claim3AccidentDate.Year;

            txtClaimLast2NAF1.Text = _referenceuserothers.NOCLast2Claim1NotAtFault;
            txtClaimLast2AF1.Text = _referenceuserothers.NOCLast2Claim1AtFault;
            txtClaimLast2Windscreen1.Text = _referenceuserothers.NOCLast2Claim1Windscreen;
            usrClaimLast2AccidentDate1.Day = _referenceuserothers.NOCLast2Claim1AccidentDate.Day;
            usrClaimLast2AccidentDate1.Month = _referenceuserothers.NOCLast2Claim1AccidentDate.Month;
            usrClaimLast2AccidentDate1.Year = _referenceuserothers.NOCLast2Claim1AccidentDate.Year;

            txtClaimLast2NAF2.Text = _referenceuserothers.NOCLast2Claim2NotAtFault;
            txtClaimLast2AF2.Text = _referenceuserothers.NOCLast2Claim2AtFault;
            txtClaimLast2Windscreen2.Text = _referenceuserothers.NOCLast2Claim2Windscreen;
            usrClaimLast2AccidentDate2.Day = _referenceuserothers.NOCLast2Claim2AccidentDate.Day;
            usrClaimLast2AccidentDate2.Month = _referenceuserothers.NOCLast2Claim2AccidentDate.Month;
            usrClaimLast2AccidentDate2.Year = _referenceuserothers.NOCLast2Claim2AccidentDate.Year;

            txtClaimLast2NAF3.Text = _referenceuserothers.NOCLast2Claim3NotAtFault;
            txtClaimLast2AF3.Text = _referenceuserothers.NOCLast2Claim3AtFault;
            txtClaimLast2Windscreen3.Text = _referenceuserothers.NOCLast2Claim3Windscreen;
            usrClaimLast2AccidentDate3.Day = _referenceuserothers.NOCLast3Claim3AccidentDate.Day;
            usrClaimLast2AccidentDate3.Month = _referenceuserothers.NOCLast3Claim3AccidentDate.Month;
            usrClaimLast2AccidentDate3.Year = _referenceuserothers.NOCLast3Claim3AccidentDate.Year;

            txtClaimLast1NAF1.Text = _referenceuserothers.NOCLast1Claim1NotAtFault;
            txtClaimLast1AF1.Text = _referenceuserothers.NOCLast1Claim1AtFault;
            txtClaimLast1Windscreen1.Text = _referenceuserothers.NOCLast1Claim1Windscreen;
            usrClaimLast1AccidentDate1.Day = _referenceuserothers.NOCLast1Claim1AccidentDate.Day;
            usrClaimLast1AccidentDate1.Month = _referenceuserothers.NOCLast1Claim1AccidentDate.Month;
            usrClaimLast1AccidentDate1.Year = _referenceuserothers.NOCLast1Claim1AccidentDate.Year;

            txtClaimLast1NAF2.Text = _referenceuserothers.NOCLast1Claim2NotAtFault;
            txtClaimLast1AF2.Text = _referenceuserothers.NOCLast1Claim2AtFault;
            txtClaimLast1Windscreen2.Text = _referenceuserothers.NOCLast1Claim2Windscreen;
            usrClaimLast1AccidentDate2.Day = _referenceuserothers.NOCLast1Claim2AccidentDate.Day;
            usrClaimLast1AccidentDate2.Month = _referenceuserothers.NOCLast1Claim2AccidentDate.Month;
            usrClaimLast1AccidentDate2.Year = _referenceuserothers.NOCLast1Claim2AccidentDate.Year;

            txtClaimLast1NAF3.Text = _referenceuserothers.NOCLast1Claim3NotAtFault;
            txtClaimLast1AF3.Text = _referenceuserothers.NOCLast1Claim3AtFault;
            txtClaimLast1Windscreen3.Text = _referenceuserothers.NOCLast1Claim3Windscreen;
            usrClaimLast1AccidentDate3.Day = _referenceuserothers.NOCLast1Claim3AccidentDate.Day;
            usrClaimLast1AccidentDate3.Month = _referenceuserothers.NOCLast1Claim3AccidentDate.Month;
            usrClaimLast1AccidentDate3.Year = _referenceuserothers.NOCLast1Claim3AccidentDate.Year;

            txtRenewalQuoteReceived.Text = _referenceuserothers.RenewalQuoteReceived.ToString();

            if (_referenceuserothers.Driver1Relation != "")
            {
                txtDriver1Relation.Text = _referenceuserothers.Driver1Relation;
                txtDriver1Name.Text = _referenceuserothers.Driver1Name;

                if (_referenceuserothers.Driver1NRIC.ToString() != "")
                {
                    usrDriver1NRIC.Prefix = _referenceuserothers.Driver1NRIC.ToString().Substring(0, 1);
                    usrDriver1NRIC.IDNumber = _referenceuserothers.Driver1NRIC.ToString().Substring(8, 1);
                    usrDriver1NRIC.Postfix = _referenceuserothers.Driver1NRIC.ToString().Substring(1, 1);
                }
                usrDriver1LicensePassDate.Day = _referenceuserothers.Driver1LicensePassDate.Day;
                usrDriver1LicensePassDate.Month = _referenceuserothers.Driver1LicensePassDate.Month;
                usrDriver1LicensePassDate.Year = _referenceuserothers.Driver1LicensePassDate.Year;
            }

            if (_referenceuserothers.Driver2Relation != "")
            {
                txtDriver2Relation.Text = _referenceuserothers.Driver2Relation;
                txtDriver2Name.Text = _referenceuserothers.Driver2Name;

                if (_referenceuserothers.Driver2NRIC.ToString() != "")
                {
                    usrDriver2NRIC.Prefix = _referenceuserothers.Driver2NRIC.ToString().Substring(0, 1);
                    usrDriver2NRIC.IDNumber = _referenceuserothers.Driver2NRIC.ToString().Substring(8, 1);
                    usrDriver2NRIC.Postfix = _referenceuserothers.Driver2NRIC.ToString().Substring(1, 1);
                }
                usrDriver2LicensePassDate.Day = _referenceuserothers.Driver2LicensePassDate.Day;
                usrDriver2LicensePassDate.Month = _referenceuserothers.Driver2LicensePassDate.Month;
                usrDriver2LicensePassDate.Year = _referenceuserothers.Driver2LicensePassDate.Year;
            }

            if (_referenceuserothers.Driver3Relation != "")
            {
                txtDriver3Relation.Text = _referenceuserothers.Driver3Relation;
                txtDriver3Name.Text = _referenceuserothers.Driver3Name;

                if (_referenceuserothers.Driver3NRIC.ToString() != "")
                {
                    usrDriver3NRIC.Prefix = _referenceuserothers.Driver3NRIC.ToString().Substring(0, 1);
                    usrDriver3NRIC.IDNumber = _referenceuserothers.Driver3NRIC.ToString().Substring(8, 1);
                    usrDriver3NRIC.Postfix = _referenceuserothers.Driver3NRIC.ToString().Substring(1, 1);
                }
                usrDriver3LicensePassDate.Day = _referenceuserothers.Driver3LicensePassDate.Day;
                usrDriver3LicensePassDate.Month = _referenceuserothers.Driver3LicensePassDate.Month;
                usrDriver3LicensePassDate.Year = _referenceuserothers.Driver3LicensePassDate.Year;
            }

            if (_referenceuserothers.Driver4Relation != "")
            {
                txtDriver4Relation.Text = _referenceuserothers.Driver4Relation;
                txtDriver4Name.Text = _referenceuserothers.Driver4Name;

                if (_referenceuserothers.Driver4NRIC.ToString() != "")
                {
                    usrDriver4NRIC.Prefix = _referenceuserothers.Driver4NRIC.ToString().Substring(0, 1);
                    usrDriver4NRIC.IDNumber = _referenceuserothers.Driver4NRIC.ToString().Substring(8, 1);
                    usrDriver4NRIC.Postfix = _referenceuserothers.Driver4NRIC.ToString().Substring(1, 1);
                }
                usrDriver4LicensePassDate.Day = _referenceuserothers.Driver4LicensePassDate.Day;
                usrDriver4LicensePassDate.Month = _referenceuserothers.Driver4LicensePassDate.Month;
                usrDriver4LicensePassDate.Year = _referenceuserothers.Driver4LicensePassDate.Year;
            }

            if (_referenceuserothers.Driver5Relation != "")
            {
                txtDriver5Relation.Text = _referenceuserothers.Driver5Relation;
                txtDriver5Name.Text = _referenceuserothers.Driver5Name;

                if (_referenceuserothers.Driver5NRIC.ToString() != "")
                {
                    usrDriver5NRIC.Prefix = _referenceuserothers.Driver5NRIC.ToString().Substring(0, 1);
                    usrDriver5NRIC.IDNumber = _referenceuserothers.Driver5NRIC.ToString().Substring(8, 1);
                    usrDriver5NRIC.Postfix = _referenceuserothers.Driver5NRIC.ToString().Substring(1, 1);
                }
                usrDriver5LicensePassDate.Day = _referenceuserothers.Driver5LicensePassDate.Day;
                usrDriver5LicensePassDate.Month = _referenceuserothers.Driver5LicensePassDate.Month;
                usrDriver5LicensePassDate.Year = _referenceuserothers.Driver5LicensePassDate.Year;
            }

            divClaimLast3.Visible = false;
            tblLast3Claim1.Visible = false;
            tblLast3Claim2.Visible = false;
            tblLast3Claim3.Visible = false;

            divClaimLast2.Visible = false;
            tblLast2Claim1.Visible = false;
            tblLast2Claim2.Visible = false;
            tblLast2Claim3.Visible = false;

            divClaimLast1.Visible = false;
            tblLast1Claim1.Visible = false;
            tblLast1Claim2.Visible = false;
            tblLast1Claim3.Visible = false;

            ddlNoOfClaim3.Visible = false;
            ddlNoOfClaim2.Visible = false;
            ddlNoOfClaim1.Visible = false;

            rfvNoOfClaim3.Enabled = false;
            rfvNoOfClaim2.Enabled = false;
            rfvNoOfClaim1.Enabled = false;

            lblbreakdown1.Visible = false;
            lblbreakdown2.Visible = false;
            lblbreakdown3.Visible = false;

            if (_referenceuserothers.NOCLast3.ToString() != "0" || _referenceuserothers.NOCLast2.ToString() != "0" || _referenceuserothers.NOCLast1.ToString() != "0")
            {
                pnlClaims.Visible = true;

                if (_referenceuserothers.NOCLast3.ToString() != "0")
                {
                    pnlClaimLast3.Visible = true;
                    divClaimLast3.Visible = true;
                    ddlNoOfClaim3.Text = _referenceuserothers.NOCLast3.ToString();
                    lblbreakdown3.Visible = true;
                    ddlNoOfClaim3.Visible = true;
                    rfvNoOfClaim3.Enabled = true;

                    Int32 totalclaim = int.Parse(_referenceuserothers.NOCLast3Claim1AtFault) + int.Parse(_referenceuserothers.NOCLast3Claim1NotAtFault) + int.Parse(_referenceuserothers.NOCLast3Claim1Windscreen)
                     + int.Parse(_referenceuserothers.NOCLast3Claim2AtFault) + int.Parse(_referenceuserothers.NOCLast3Claim2NotAtFault) + int.Parse(_referenceuserothers.NOCLast3Claim2Windscreen)
                     + int.Parse(_referenceuserothers.NOCLast3Claim3AtFault) + int.Parse(_referenceuserothers.NOCLast3Claim3NotAtFault) + int.Parse(_referenceuserothers.NOCLast3Claim3Windscreen);

                    lblLast3ClaimValue.Text = totalclaim.ToString();

                    if (ddlNoOfClaim3.Text == "1")
                    {
                        tblLast3Claim1.Visible = true;
                    }
                    else if (ddlNoOfClaim3.Text == "2")
                    {
                        tblLast3Claim1.Visible = true;
                        tblLast3Claim2.Visible = true;
                    }
                    else if (ddlNoOfClaim3.Text == "3")
                    {
                        tblLast3Claim1.Visible = true;
                        tblLast3Claim2.Visible = true;
                        tblLast3Claim3.Visible = true;
                    }
                }
                if (_referenceuserothers.NOCLast2.ToString() != "0")
                {
                    pnlClaimLast2.Visible = true;
                    divClaimLast2.Visible = true;
                    ddlNoOfClaim2.Text = _referenceuserothers.NOCLast2.ToString();
                    lblbreakdown2.Visible = true;
                    ddlNoOfClaim2.Visible = true;
                    rfvNoOfClaim2.Enabled = true;

                    Int32 totalclaim = int.Parse(_referenceuserothers.NOCLast2Claim1AtFault) + int.Parse(_referenceuserothers.NOCLast2Claim1NotAtFault) + int.Parse(_referenceuserothers.NOCLast2Claim1Windscreen)
                     + int.Parse(_referenceuserothers.NOCLast2Claim2AtFault) + int.Parse(_referenceuserothers.NOCLast2Claim2NotAtFault) + int.Parse(_referenceuserothers.NOCLast2Claim2Windscreen)
                     + int.Parse(_referenceuserothers.NOCLast2Claim3AtFault) + int.Parse(_referenceuserothers.NOCLast2Claim3NotAtFault) + int.Parse(_referenceuserothers.NOCLast2Claim3Windscreen);

                    lblLast2ClaimValue.Text = totalclaim.ToString();

                    if (ddlNoOfClaim2.Text == "1")
                    {
                        tblLast2Claim1.Visible = true;
                    }
                    else if (ddlNoOfClaim2.Text == "2")
                    {
                        tblLast2Claim1.Visible = true;
                        tblLast2Claim2.Visible = true;
                    }
                    else if (ddlNoOfClaim2.Text == "3")
                    {
                        tblLast2Claim1.Visible = true;
                        tblLast2Claim2.Visible = true;
                        tblLast2Claim3.Visible = true;
                    }
                }

                if (_referenceuserothers.NOCLast1.ToString() != "0")
                {
                    pnlClaimLast1.Visible = true;
                    divClaimLast1.Visible = true;
                    ddlNoOfClaim1.Text = _referenceuserothers.NOCLast1.ToString();
                    lblbreakdown1.Visible = true;
                    ddlNoOfClaim1.Visible = true;
                    rfvNoOfClaim1.Enabled = true;

                    Int32 totalclaim = int.Parse(_referenceuserothers.NOCLast1Claim1AtFault) + int.Parse(_referenceuserothers.NOCLast1Claim1NotAtFault) + int.Parse(_referenceuserothers.NOCLast1Claim1Windscreen)
                     + int.Parse(_referenceuserothers.NOCLast1Claim2AtFault) + int.Parse(_referenceuserothers.NOCLast1Claim2NotAtFault) + int.Parse(_referenceuserothers.NOCLast1Claim2Windscreen)
                     + int.Parse(_referenceuserothers.NOCLast1Claim3AtFault) + int.Parse(_referenceuserothers.NOCLast1Claim3NotAtFault) + int.Parse(_referenceuserothers.NOCLast1Claim3Windscreen);

                    lblLast1ClaimValue.Text = totalclaim.ToString();

                    if (ddlNoOfClaim1.Text == "1")
                    {
                        tblLast1Claim1.Visible = true;
                    }
                    else if (ddlNoOfClaim1.Text == "2")
                    {
                        tblLast1Claim1.Visible = true;
                        tblLast1Claim2.Visible = true;
                    }
                    else if (ddlNoOfClaim1.Text == "3")
                    {
                        tblLast1Claim1.Visible = true;
                        tblLast1Claim2.Visible = true;
                        tblLast1Claim3.Visible = true;
                    }
                }
            }
            else
            {
                pnlClaims.Visible = false;
            }

            divAdditionalDriver.Visible = false;
            divDriver1.Visible = false;
            divDriver2.Visible = false;
            divDriver3.Visible = false;
            divDriver4.Visible = false;
            divDriver5.Visible = false;

            if (_referenceuserothers.AddDriver)
            {
                divAdditionalDriver.Visible = true;

                if (_referenceuserothers.Driver1Relation.Trim() != "")
                {
                    divDriver1.Visible = true;
                }
                if (_referenceuserothers.Driver2Relation.Trim() != "")
                {
                    divDriver2.Visible = true;
                }
                if (_referenceuserothers.Driver3Relation.Trim() != "")
                {
                    divDriver3.Visible = true;
                }
                if (_referenceuserothers.Driver4Relation.Trim() != "")
                {
                    divDriver4.Visible = true;
                }
                if (_referenceuserothers.Driver5Relation.Trim() != "")
                {
                    divDriver5.Visible = true;
                }

            }

        }


    }
    
    private void ChangeValidationEffectServerSide(string strValidationGroup)
    {

        #region Personal Details

        //FullName
        if (rfvFullName.Enabled && rfvFullName.ValidationGroup == strValidationGroup)
        {
            rfvFullName.Validate();
            if (rfvFullName.IsValid == false)
            {
                txtFullName.ControlStyle.CssClass = "validationError";
            }
            else
            {
                txtFullName.ControlStyle.CssClass = "";
            }
        }
        else
        {
            txtFullName.ControlStyle.CssClass = "";
        }

        if (revFullName.Enabled && revFullName.ValidationGroup == strValidationGroup)
        {
            if (rfvFullName.IsValid)
            {
                revFullName.Validate();
                if (revFullName.IsValid == false)
                {
                    txtFullName.ControlStyle.CssClass = "validationError";
                }
                else
                {
                    txtFullName.ControlStyle.CssClass = "";
                }
            }
        }
        else
        {
            txtFullName.ControlStyle.CssClass = "";
        }

        //NRIC Number
        ddlIdNumber.ChangeValidationEffectServerSide(strValidationGroup);

        //Vehicle No
        if (rfvVehicleNo.Enabled && rfvVehicleNo.ValidationGroup == strValidationGroup)
        {
            rfvVehicleNo.Validate();
            if (rfvVehicleNo.IsValid == false)
            {
                txtVehicleNo.ControlStyle.CssClass = "validationError";
            }
            else
            {
                txtVehicleNo.ControlStyle.CssClass = "";
            }
        }
        else
        {
            txtVehicleNo.ControlStyle.CssClass = "";
        }

        if (revVehicleNo.Enabled && revVehicleNo.ValidationGroup == strValidationGroup)
        {
            if (rfvVehicleNo.IsValid)
            {
                revVehicleNo.Validate();
                if (revVehicleNo.IsValid == false)
                {
                    txtVehicleNo.ControlStyle.CssClass = "validationError";
                }
                else
                {
                    txtVehicleNo.ControlStyle.CssClass = "";
                }
            }
        }
        else
        {
            txtVehicleNo.ControlStyle.CssClass = "";
        }

        //Mobile Number
        txtMobileNo.ChangeValidationEffectServerSide(strValidationGroup);
        #endregion

        //other ref details
        #region otherdetails

        usrDrivingLicenseDate.ChangeValidationEffectServerSide(strValidationGroup);

        usrClaimLast3AccidentDate1.ChangeValidationEffectServerSide(strValidationGroup);
        usrClaimLast3AccidentDate2.ChangeValidationEffectServerSide(strValidationGroup);
        usrClaimLast3AccidentDate3.ChangeValidationEffectServerSide(strValidationGroup);

        usrClaimLast2AccidentDate1.ChangeValidationEffectServerSide(strValidationGroup);
        usrClaimLast2AccidentDate2.ChangeValidationEffectServerSide(strValidationGroup);
        usrClaimLast2AccidentDate3.ChangeValidationEffectServerSide(strValidationGroup);

        usrClaimLast3AccidentDate1.ChangeValidationEffectServerSide(strValidationGroup);
        usrClaimLast3AccidentDate2.ChangeValidationEffectServerSide(strValidationGroup);
        usrClaimLast3AccidentDate3.ChangeValidationEffectServerSide(strValidationGroup);

        if (rfvSuspension.Enabled && rfvSuspension.ValidationGroup == strValidationGroup)
        {
            rfvSuspension.Validate();
            if (rfvSuspension.IsValid == false)
            {
                lblSuspensionYes.ControlStyle.CssClass = "validationError";
                lblSuspensionNo.ControlStyle.CssClass = "validationError";
            }
            else
            {
                lblSuspensionYes.ControlStyle.CssClass = "";
                lblSuspensionNo.ControlStyle.CssClass = "";
            }
        }
        else
        {
            lblSuspensionYes.ControlStyle.CssClass = "";
            lblSuspensionNo.ControlStyle.CssClass = "";
        }

        if (rfvPolicyCancelled.Enabled && rfvPolicyCancelled.ValidationGroup == strValidationGroup)
        {
            rfvPolicyCancelled.Validate();
            if (rfvPolicyCancelled.IsValid == false)
            {
                lblCancelledYes.ControlStyle.CssClass = "validationError";
                lblCancelledNo.ControlStyle.CssClass = "validationError";
            }
            else
            {
                lblCancelledYes.ControlStyle.CssClass = "";
                lblCancelledNo.ControlStyle.CssClass = "";
            }
        }
        else
        {
            lblCancelledYes.ControlStyle.CssClass = "";
            lblCancelledNo.ControlStyle.CssClass = "";
        }

        if (rfvNoOfClaim3.Enabled && rfvNoOfClaim3.ValidationGroup == strValidationGroup)
        {
            rfvNoOfClaim3.Validate();
            if (rfvNoOfClaim3.IsValid == false)
            {
                ddlNoOfClaim3.ControlStyle.CssClass = "validationError";
            }
            else
            {
                ddlNoOfClaim3.ControlStyle.CssClass = "";
            }
        }
        else
        {
            ddlNoOfClaim3.ControlStyle.CssClass = "";
        }

        if (rfvClaimLast3NAF1.Enabled && rfvClaimLast3NAF1.ValidationGroup == strValidationGroup)
        {
            rfvClaimLast3NAF1.Validate();
            if (rfvClaimLast3NAF1.IsValid == false)
            {
                txtClaimLast3NAF1.ControlStyle.CssClass = "validationError";
            }
            else
            {
                txtClaimLast3NAF1.ControlStyle.CssClass = "";
            }
        }
        else
        {
            txtClaimLast3NAF1.ControlStyle.CssClass = "";
        }

        if (revClaimLast3NAF1.Enabled && revClaimLast3NAF1.ValidationGroup == strValidationGroup)
        {
            if (rfvClaimLast3NAF1.IsValid)
            {
                revClaimLast3NAF1.Validate();
                if (revClaimLast3NAF1.IsValid == false)
                {
                    txtClaimLast3NAF1.ControlStyle.CssClass = "validationError";
                }
                else
                {
                    txtClaimLast3NAF1.ControlStyle.CssClass = "";
                }
            }
        }
        else
        {
            txtClaimLast3NAF1.ControlStyle.CssClass = "";
        }

        if (rfvClaimLast3NAF2.Enabled && rfvClaimLast3NAF2.ValidationGroup == strValidationGroup)
        {
            rfvClaimLast3NAF2.Validate();
            if (rfvClaimLast3NAF2.IsValid == false)
            {
                txtClaimLast3NAF2.ControlStyle.CssClass = "validationError";
            }
            else
            {
                txtClaimLast3NAF2.ControlStyle.CssClass = "";
            }
        }
        else
        {
            txtClaimLast3NAF2.ControlStyle.CssClass = "";
        }

        if (revClaimLast3NAF2.Enabled && revClaimLast3NAF2.ValidationGroup == strValidationGroup)
        {
            if (rfvClaimLast3NAF2.IsValid)
            {
                revClaimLast3NAF2.Validate();
                if (revClaimLast3NAF2.IsValid == false)
                {
                    txtClaimLast3NAF2.ControlStyle.CssClass = "validationError";
                }
                else
                {
                    txtClaimLast3NAF2.ControlStyle.CssClass = "";
                }
            }
        }
        else
        {
            txtClaimLast3NAF2.ControlStyle.CssClass = "";
        }

        if (rfvClaimLast3NAF3.Enabled && rfvClaimLast3NAF3.ValidationGroup == strValidationGroup)
        {
            rfvClaimLast3NAF3.Validate();
            if (rfvClaimLast3NAF3.IsValid == false)
            {
                txtClaimLast3NAF3.ControlStyle.CssClass = "validationError";
            }
            else
            {
                txtClaimLast3NAF3.ControlStyle.CssClass = "";
            }
        }
        else
        {
            txtClaimLast3NAF3.ControlStyle.CssClass = "";
        }

        if (revClaimLast3NAF3.Enabled && revClaimLast3NAF3.ValidationGroup == strValidationGroup)
        {
            if (rfvClaimLast3NAF3.IsValid)
            {
                revClaimLast3NAF3.Validate();
                if (revClaimLast3NAF3.IsValid == false)
                {
                    txtClaimLast3NAF3.ControlStyle.CssClass = "validationError";
                }
                else
                {
                    txtClaimLast3NAF3.ControlStyle.CssClass = "";
                }
            }
        }
        else
        {
            txtClaimLast3NAF3.ControlStyle.CssClass = "";
        }

        //last2
        if (rfvNoOfClaim2.Enabled && rfvNoOfClaim2.ValidationGroup == strValidationGroup)
        {
            rfvNoOfClaim2.Validate();
            if (rfvNoOfClaim2.IsValid == false)
            {
                ddlNoOfClaim2.ControlStyle.CssClass = "validationError";
            }
            else
            {
                ddlNoOfClaim2.ControlStyle.CssClass = "";
            }
        }
        else
        {
            ddlNoOfClaim2.ControlStyle.CssClass = "";
        }

        if (rfvClaimLast2NAF1.Enabled && rfvClaimLast2NAF1.ValidationGroup == strValidationGroup)
        {
            rfvClaimLast2NAF1.Validate();
            if (rfvClaimLast2NAF1.IsValid == false)
            {
                txtClaimLast2NAF1.ControlStyle.CssClass = "validationError";
            }
            else
            {
                txtClaimLast2NAF1.ControlStyle.CssClass = "";
            }
        }
        else
        {
            txtClaimLast2NAF1.ControlStyle.CssClass = "";
        }

        if (revClaimLast2NAF1.Enabled && revClaimLast2NAF1.ValidationGroup == strValidationGroup)
        {
            if (rfvClaimLast2NAF1.IsValid)
            {
                revClaimLast2NAF1.Validate();
                if (revClaimLast2NAF1.IsValid == false)
                {
                    txtClaimLast2NAF1.ControlStyle.CssClass = "validationError";
                }
                else
                {
                    txtClaimLast2NAF1.ControlStyle.CssClass = "";
                }
            }
        }
        else
        {
            txtClaimLast2NAF1.ControlStyle.CssClass = "";
        }

        if (rfvClaimLast2NAF2.Enabled && rfvClaimLast2NAF2.ValidationGroup == strValidationGroup)
        {
            rfvClaimLast2NAF2.Validate();
            if (rfvClaimLast2NAF2.IsValid == false)
            {
                txtClaimLast2NAF2.ControlStyle.CssClass = "validationError";
            }
            else
            {
                txtClaimLast2NAF2.ControlStyle.CssClass = "";
            }
        }
        else
        {
            txtClaimLast2NAF2.ControlStyle.CssClass = "";
        }

        if (revClaimLast2NAF2.Enabled && revClaimLast2NAF2.ValidationGroup == strValidationGroup)
        {
            if (rfvClaimLast2NAF2.IsValid)
            {
                revClaimLast2NAF2.Validate();
                if (revClaimLast2NAF2.IsValid == false)
                {
                    txtClaimLast2NAF2.ControlStyle.CssClass = "validationError";
                }
                else
                {
                    txtClaimLast2NAF2.ControlStyle.CssClass = "";
                }
            }
        }
        else
        {
            txtClaimLast2NAF2.ControlStyle.CssClass = "";
        }

        if (rfvClaimLast2NAF3.Enabled && rfvClaimLast2NAF3.ValidationGroup == strValidationGroup)
        {
            rfvClaimLast2NAF3.Validate();
            if (rfvClaimLast2NAF3.IsValid == false)
            {
                txtClaimLast2NAF3.ControlStyle.CssClass = "validationError";
            }
            else
            {
                txtClaimLast2NAF3.ControlStyle.CssClass = "";
            }
        }
        else
        {
            txtClaimLast2NAF3.ControlStyle.CssClass = "";
        }

        if (revClaimLast2NAF3.Enabled && revClaimLast2NAF3.ValidationGroup == strValidationGroup)
        {
            if (rfvClaimLast2NAF3.IsValid)
            {
                revClaimLast2NAF3.Validate();
                if (revClaimLast2NAF3.IsValid == false)
                {
                    txtClaimLast2NAF3.ControlStyle.CssClass = "validationError";
                }
                else
                {
                    txtClaimLast2NAF3.ControlStyle.CssClass = "";
                }
            }
        }
        else
        {
            txtClaimLast2NAF3.ControlStyle.CssClass = "";
        }

        //last 3
        if (rfvNoOfClaim1.Enabled && rfvNoOfClaim1.ValidationGroup == strValidationGroup)
        {
            rfvNoOfClaim1.Validate();
            if (rfvNoOfClaim1.IsValid == false)
            {
                ddlNoOfClaim1.ControlStyle.CssClass = "validationError";
            }
            else
            {
                ddlNoOfClaim1.ControlStyle.CssClass = "";
            }
        }
        else
        {
            ddlNoOfClaim1.ControlStyle.CssClass = "";
        }

        if (rfvClaimLast1NAF1.Enabled && rfvClaimLast1NAF1.ValidationGroup == strValidationGroup)
        {
            rfvClaimLast1NAF1.Validate();
            if (rfvClaimLast1NAF1.IsValid == false)
            {
                txtClaimLast1NAF1.ControlStyle.CssClass = "validationError";
            }
            else
            {
                txtClaimLast1NAF1.ControlStyle.CssClass = "";
            }
        }
        else
        {
            txtClaimLast1NAF1.ControlStyle.CssClass = "";
        }

        if (revClaimLast1NAF1.Enabled && revClaimLast1NAF1.ValidationGroup == strValidationGroup)
        {
            if (rfvClaimLast1NAF1.IsValid)
            {
                revClaimLast1NAF1.Validate();
                if (revClaimLast1NAF1.IsValid == false)
                {
                    txtClaimLast1NAF1.ControlStyle.CssClass = "validationError";
                }
                else
                {
                    txtClaimLast1NAF1.ControlStyle.CssClass = "";
                }
            }
        }
        else
        {
            txtClaimLast1NAF1.ControlStyle.CssClass = "";
        }

        if (rfvClaimLast1NAF2.Enabled && rfvClaimLast1NAF2.ValidationGroup == strValidationGroup)
        {
            rfvClaimLast1NAF2.Validate();
            if (rfvClaimLast1NAF2.IsValid == false)
            {
                txtClaimLast1NAF2.ControlStyle.CssClass = "validationError";
            }
            else
            {
                txtClaimLast1NAF2.ControlStyle.CssClass = "";
            }
        }
        else
        {
            txtClaimLast1NAF2.ControlStyle.CssClass = "";
        }

        if (revClaimLast1NAF2.Enabled && revClaimLast1NAF2.ValidationGroup == strValidationGroup)
        {
            if (rfvClaimLast1NAF2.IsValid)
            {
                revClaimLast1NAF2.Validate();
                if (revClaimLast1NAF2.IsValid == false)
                {
                    txtClaimLast1NAF2.ControlStyle.CssClass = "validationError";
                }
                else
                {
                    txtClaimLast1NAF2.ControlStyle.CssClass = "";
                }
            }
        }
        else
        {
            txtClaimLast1NAF2.ControlStyle.CssClass = "";
        }

        if (rfvClaimLast1NAF3.Enabled && rfvClaimLast1NAF3.ValidationGroup == strValidationGroup)
        {
            rfvClaimLast1NAF3.Validate();
            if (rfvClaimLast1NAF3.IsValid == false)
            {
                txtClaimLast1NAF3.ControlStyle.CssClass = "validationError";
            }
            else
            {
                txtClaimLast1NAF3.ControlStyle.CssClass = "";
            }
        }
        else
        {
            txtClaimLast1NAF3.ControlStyle.CssClass = "";
        }

        if (revClaimLast1NAF3.Enabled && revClaimLast1NAF3.ValidationGroup == strValidationGroup)
        {
            if (rfvClaimLast1NAF3.IsValid)
            {
                revClaimLast1NAF3.Validate();
                if (revClaimLast1NAF3.IsValid == false)
                {
                    txtClaimLast1NAF3.ControlStyle.CssClass = "validationError";
                }
                else
                {
                    txtClaimLast1NAF3.ControlStyle.CssClass = "";
                }
            }
        }
        else
        {
            txtClaimLast1NAF3.ControlStyle.CssClass = "";
        }

        if (ddlNoMatchCoverType.SelectedValue == "1")
        {
            rfvComprehensive.Enabled = true;
        }
        else
        {
            rfvComprehensive.Enabled = false;
        }


        #endregion

    }
    
    public bool CheckCommencementDateExpiry(Int64 RefCEUserId, Int64 CECarId)
    {
        bool _Status = true;
        MyDatabase _db = new MyDatabase();
        string strSql = "SELECT CoverageCommenceDate FROM tblCarPolicy WHERE RefCEUserId = " + RefCEUserId + " AND CECarId =  " + CECarId;
        object _Count = _db.ExecuteScalarSqlStatement(strSql);
        if (_Count != null)
        {
            DateTime _CoverDate = Convert.ToDateTime(_Count);
            DateTime _todayDate = new DateTime(CE.Global.General.GetUTCDateTime().Year, CE.Global.General.GetUTCDateTime().Month, CE.Global.General.GetUTCDateTime().Day);
            DateTime _CommencementDate = new DateTime(_CoverDate.Year, _CoverDate.Month, _CoverDate.Day);
            if (_todayDate.CompareTo(_CommencementDate) > 0)
            {
                _Status = false;
            }
        }
        return _Status;
    }

    private void CheckClaimAndDriverDetails(Int64 CarId, Int64 UserId)
    {
        divClaimLast3.Visible = false;
        tblLast3Claim1.Visible = false;
        tblLast3Claim2.Visible = false;
        tblLast3Claim3.Visible = false;

        divClaimLast2.Visible = false;
        tblLast2Claim1.Visible = false;
        tblLast2Claim2.Visible = false;
        tblLast2Claim3.Visible = false;

        divClaimLast1.Visible = false;
        tblLast1Claim1.Visible = false;
        tblLast1Claim2.Visible = false;
        tblLast1Claim3.Visible = false;

        ddlNoOfClaim3.Visible = false;
        ddlNoOfClaim2.Visible = false;
        ddlNoOfClaim1.Visible = false;

        rfvNoOfClaim3.Enabled = false;
        rfvNoOfClaim2.Enabled = false;
        rfvNoOfClaim1.Enabled = false;

        lblbreakdown1.Visible = false;
        lblbreakdown2.Visible = false;
        lblbreakdown3.Visible = false;

        CarPolicy _carpolicy = new CarPolicy();
        CarPolicyDB _carpolicydb = new CarPolicyDB();
        Int64 PolicyId = 0;

        if (Session[General.CarPolicyId] != null)
        {
            PolicyId = Convert.ToInt64(Session[General.CarPolicyId]);
        }

        _carpolicy = _carpolicydb.GetCarPolicy(CarId, PolicyId, UserId);
        if (_carpolicy != null)
        {
            bool hasClaim = _carpolicy.IsClaimLastThreeYear;

            if (hasClaim)
            {

                CarClaimHistory _carclaimhistory = new CarClaimHistory();
                CarClaimHistoryDB _carclaimhistorydb = new CarClaimHistoryDB();
                _carclaimhistory = _carclaimhistorydb.GetCarClaimHistory(_carpolicy.CECarId, _carpolicy.RefCEUserId);
                if (_carclaimhistory != null)
                {
                    pnlClaims.Visible = true;

                    if (_carclaimhistory.NoOfClaimInLast3Year.ToString() != "0")
                    {
                        pnlClaimLast3.Visible = true;
                        divClaimLast3.Visible = true;
                        ddlNoOfClaim3.Text = _carclaimhistory.NoOfClaimInLast3Year.ToString();
                        lblLast3ClaimValue.Text = _carclaimhistory.Last3YearClaimValue.ToString();
                        lblbreakdown3.Visible = true;

                        ddlNoOfClaim3.Visible = true;
                        rfvNoOfClaim3.Enabled = true;

                        if (ddlNoOfClaim3.Text == "1")
                        {
                            tblLast3Claim1.Visible = true;
                        }
                        else if (ddlNoOfClaim3.Text == "2")
                        {
                            tblLast3Claim1.Visible = true;
                            tblLast3Claim2.Visible = true;
                        }
                        else if (ddlNoOfClaim3.Text == "3")
                        {
                            tblLast3Claim1.Visible = true;
                            tblLast3Claim2.Visible = true;
                            tblLast3Claim3.Visible = true;
                        }
                    }


                    if (_carclaimhistory.NoOfClaimInLast2Year.ToString() != "0")
                    {
                        pnlClaimLast2.Visible = true;
                        divClaimLast2.Visible = true;
                        ddlNoOfClaim2.Text = _carclaimhistory.NoOfClaimInLast2Year.ToString();
                        lblLast2ClaimValue.Text = _carclaimhistory.Last2YearClaimValue.ToString();
                        lblbreakdown2.Visible = true;

                        ddlNoOfClaim2.Visible = true;
                        rfvNoOfClaim2.Enabled = true;

                        if (ddlNoOfClaim2.Text == "1")
                        {
                            tblLast2Claim1.Visible = true;
                        }
                        else if (ddlNoOfClaim2.Text == "2")
                        {
                            tblLast2Claim1.Visible = true;
                            tblLast2Claim2.Visible = true;
                        }
                        else if (ddlNoOfClaim2.Text == "3")
                        {
                            tblLast2Claim1.Visible = true;
                            tblLast2Claim2.Visible = true;
                            tblLast2Claim3.Visible = true;
                        }
                    }

                    if (_carclaimhistory.NoOfClaimInLast1Year.ToString() != "0")
                    {
                        pnlClaimLast1.Visible = true;
                        divClaimLast1.Visible = true;
                        ddlNoOfClaim1.Text = _carclaimhistory.NoOfClaimInLast1Year.ToString();
                        lblLast1ClaimValue.Text = _carclaimhistory.Last1YearClaimValue.ToString();
                        lblbreakdown1.Visible = true;

                        ddlNoOfClaim1.Visible = true;
                        rfvNoOfClaim1.Enabled = true;

                        if (ddlNoOfClaim1.Text == "1")
                        {
                            tblLast1Claim1.Visible = true;
                        }
                        else if (ddlNoOfClaim1.Text == "2")
                        {
                            tblLast1Claim1.Visible = true;
                            tblLast1Claim2.Visible = true;
                        }
                        else if (ddlNoOfClaim1.Text == "3")
                        {
                            tblLast1Claim1.Visible = true;
                            tblLast1Claim2.Visible = true;
                            tblLast1Claim3.Visible = true;
                        }
                    }
                }
            }
            else
            {
                pnlClaims.Visible = false;
            }

            divAdditionalDriver.Visible = false;
            divDriver1.Visible = false;
            divDriver2.Visible = false;
            divDriver3.Visible = false;
            divDriver4.Visible = false;
            divDriver5.Visible = false;

            if (_carpolicy.IsAddDriver && _carpolicy.NoOfDriver > 0)
            {
                divAdditionalDriver.Visible = true;

                if (_carpolicy.NoOfDriver == 1)
                {
                    divDriver1.Visible = true;
                }
                else if (_carpolicy.NoOfDriver == 2)
                {
                    divDriver1.Visible = true;
                    divDriver2.Visible = true;
                }
                else if (_carpolicy.NoOfDriver == 3)
                {
                    divDriver1.Visible = true;
                    divDriver2.Visible = true;
                    divDriver3.Visible = true;
                }
                else if (_carpolicy.NoOfDriver == 4)
                {
                    divDriver1.Visible = true;
                    divDriver2.Visible = true;
                    divDriver3.Visible = true;
                    divDriver4.Visible = true;
                }
                else if (_carpolicy.NoOfDriver == 5)
                {
                    divDriver1.Visible = true;
                    divDriver2.Visible = true;
                    divDriver3.Visible = true;
                    divDriver4.Visible = true;
                    divDriver5.Visible = true;
                }

            }

        }


        Profile _profile = new Profile();
        ProfileDB _profiledb = new ProfileDB();

        _profile = _profiledb.GetProfile(UserId);
        int yrsdriving = _profile.YearDriveSg;
        //usrDrivingLicenseDate.Day = 1;
        //usrDrivingLicenseDate.Month = CE.Global.General.GetUTCDateTime().Month;
        //usrDrivingLicenseDate.Year = CE.Global.General.GetUTCDateTime().AddYears(-yrsdriving).Year;

        _carpolicy = null;
        _carpolicydb = null;

    }

    private void ShowQuoteSummary()
    {
        CarDetail _cardetail = new CarDetail();
        CarPolicy _carpolicy = new CarPolicy();

        CarDetailDB _cardetaildb = new CarDetailDB();
        CarPolicyDB _carpolicydb = new CarPolicyDB();

        ProfileDB _profiledb = new ProfileDB();
        Profile _profile = new Profile();

        _cardetail = _cardetaildb.GetCar(Convert.ToInt64(Session[General.CarId].ToString()), Convert.ToInt64(Session[General.UserId].ToString()));

        _profile = _profiledb.GetProfile(Convert.ToInt64(Session[General.UserId].ToString()));

        if (_profile != null && _cardetail != null)
        {
            //Update User Profile
            _cardetail.Info10 = _profile.SurName.ToString();
            if (_profile.FirstName.Length > 0)
            {
                _cardetail.Info10 += " " + _profile.FirstName;
            }
            _cardetail.Info11 = _profile.Gender.ToString();
            _cardetail.Info12 = _profile.DOB.ToString("dd-MMM-yyyy");
            _cardetail.Info13 = _profile.Occupation.ToString();
            _cardetail.Info14 = _profile.JobNature.ToString();
            _cardetail.Info15 = _profile.MaritalStatus.ToString();
            _cardetail.Info16 = _profile.YearDriveSg.ToString();
        }

        _cardetaildb.Insert(_cardetail);

        _carpolicy = _carpolicydb.GetCarPolicy(Convert.ToInt64(Session[General.CarId].ToString()), Convert.ToInt64(Session[General.UserId].ToString()));

        if (_cardetail != null && _carpolicy != null)
        {
            if (_cardetail.CarMakeId == 9999 && _cardetail.CarModelId == 9999)
            {
                //btnBack.Visible = false;
                //btnNoMatchBack.Visible = true;
                lblRMessage.Text = "Result: No Instant Matches Found!";
                //divNoMatchFound.Visible = false;
                //divNoInstantMatchFound.Visible = true;
            }
            else
            {
                //ibtBack.Visible = false;
                //ibtNoMatchBack.Visible = true;
                //divNoMatchFound.Visible = false;
                //divNoInstantMatchFound.Visible = true;
            }
            lblYrofManufacture.Text = _cardetail.ManufactYear.ToString();
            lblYrofRegister.Text = _cardetail.RegYear.ToString();
            lblYrofRegisterTop.Text = _cardetail.RegYear.ToString();

            lblCarMakemodel.Text = _cardetail.MakeModelDesc;
            lblCarMakemodelTop.Text = _cardetail.MakeModelDesc;
            if (lblCarMakemodelTop.Text.Length > 40)
            {
                lblCarMakemodelTop.Font.Size = new FontUnit(8.0d);
                lblCarMakemodelTop.ToolTip = _cardetail.MakeModelDesc;
            }

            lblOffpeakvehile.Text = _cardetail.IsPeak ? "Yes" : "No";

            if (_carpolicy.NCDPercent == -1)
            {
                lblNCDvalue.Text = "0%";
            }
            else
            {
                lblNCDvalue.Text = _carpolicy.NCDPercent.ToString() + "%";
            }

            lblAppNCDvalue.Text = _carpolicy.Info1.ToString() + "%";
            lblAppNCDvalueTop.Text = _carpolicy.Info1.ToString() + "%";
            lblAnyclaim.Text = _carpolicy.IsClaimLastThreeYear ? "Yes" : "No";
            lblOffenceDriving.Text = _carpolicy.IsOffDriveCom ? "Yes" : "No";
            lblAddDriver.Text = _carpolicy.IsAddDriver ? "Yes" : "No";
            lblCommencementdate.Text = _carpolicy.CoverageCommenceDate.ToString("dd-MMM-yyyy");
            lblCommencementdateTop.Text = _carpolicy.CoverageCommenceDate.ToString("dd-MMM-yyyy");

            //offline page
            lblCommencementDateOffline.Text = _carpolicy.CoverageCommenceDate.ToString("dd-MMM-yyyy");

            CE.Provider.InsurerDB _insurerdb = new CE.Provider.InsurerDB();
            DataTable dtPreInsurerComp = _insurerdb.GetPreInsurer(100, 1);

            lblCurrentInsurer.Text = dtPreInsurerComp.Select("PreInsurerId = " + _cardetail.Info1)[0]["CompanyName"].ToString();
        }

        _profile = null;
        _profiledb = null;
        _cardetail = null;
        _cardetaildb = null;
        _carpolicy = null;
        _carpolicydb = null;
    }

    public string GetFilePath()
    {
        string _filePath = CE.Configuration.MyConfigurationManager.GetAppSettingValue("FileOutputPath").ToString();
        _filePath += "exceloutput\\car_nomatch\\";
        CE.InputOut.MyIO _myIO = new CE.InputOut.MyIO();
        string _todaydate = CE.Global.General.GetUTCDateTime().ToString("yyyyMMMdd");
        if (!_myIO.CheckDirectory(_filePath + _todaydate))
        {
            if (_myIO.CreateDirectory(_filePath, _todaydate))
            {
                _filePath += _todaydate + "\\";
            }
        }
        else
        {
            _filePath += _todaydate + "\\";
        }

        return _filePath;
    }

    private void DisableControls()
    {
        //disable controls
        txtFullName.ReadOnly = true;
        txtVehicleNo.ReadOnly = true;
        ddlIdNumber.IsEnabled = false;
        usrDrivingLicenseDate.IsEnabled = false;
        ddlNoMatchCoverType.Enabled = false;

        rdoSuspensionNo.Enabled = false;
        rdoSuspensionYes.Enabled = false;
        rdoCancelledNo.Enabled = false;
        rdoCancelledYes.Enabled = false;
        txtMobileNo.IsEnabled = false;

        txtClaimLast1AF1.Enabled = false;
        txtClaimLast1AF2.Enabled = false;
        txtClaimLast1AF3.Enabled = false;
        txtClaimLast1NAF1.Enabled = false;
        txtClaimLast1NAF2.Enabled = false;
        txtClaimLast1NAF3.Enabled = false;
        txtClaimLast1Windscreen1.Enabled = false;
        txtClaimLast1Windscreen2.Enabled = false;
        txtClaimLast1Windscreen3.Enabled = false;
        txtClaimLast2AF1.Enabled = false;
        txtClaimLast2AF2.Enabled = false;
        txtClaimLast2AF3.Enabled = false;
        txtClaimLast2NAF1.Enabled = false;
        txtClaimLast2NAF2.Enabled = false;
        txtClaimLast2NAF3.Enabled = false;
        txtClaimLast2Windscreen1.Enabled = false;
        txtClaimLast2Windscreen2.Enabled = false;
        txtClaimLast2Windscreen3.Enabled = false;
        txtClaimLast3AF1.Enabled = false;
        txtClaimLast3AF2.Enabled = false;
        txtClaimLast3AF3.Enabled = false;
        txtClaimLast3NAF1.Enabled = false;
        txtClaimLast3NAF2.Enabled = false;
        txtClaimLast3NAF3.Enabled = false;
        txtClaimLast3Windscreen1.Enabled = false;
        txtClaimLast3Windscreen2.Enabled = false;
        txtClaimLast3Windscreen3.Enabled = false;

        usrClaimLast1AccidentDate1.IsEnabled = false;
        usrClaimLast1AccidentDate2.IsEnabled = false;
        usrClaimLast1AccidentDate3.IsEnabled = false;
        usrClaimLast2AccidentDate1.IsEnabled = false;
        usrClaimLast2AccidentDate2.IsEnabled = false;
        usrClaimLast2AccidentDate3.IsEnabled = false;
        usrClaimLast3AccidentDate1.IsEnabled = false;
        usrClaimLast3AccidentDate2.IsEnabled = false;
        usrClaimLast3AccidentDate3.IsEnabled = false;

        txtDriver1Relation.Enabled = false;
        txtDriver2Relation.Enabled = false;
        txtDriver3Relation.Enabled = false;
        txtDriver4Relation.Enabled = false;
        txtDriver5Relation.Enabled = false;
    }

    //private void CheckValidation()
    //{
    //    if (divUserRefDetail.Visible == true)
    //    {
    //        rfvFullName.Enabled = true;
    //        revFullName.Enabled = true;
    //        ddlIdNumber.IsEnableValidation(true);
    //        txtMobileNo.IsEnableValidation(true);
    //    }
    //    else if (divUserRefDetail.Visible == false)
    //    {
    //        rfvFullName.Enabled = false;
    //        revFullName.Enabled = false;
    //        ddlIdNumber.IsEnableValidation(false);
    //        txtMobileNo.IsEnableValidation(false);
    //    }

    //    Page.Validate();
    //}

    public void LoadNoMatchCoverType(int Year)
    {
        DataTable _dtTempCINoMatchCoverType = new DataTable();
        DataTable _dtCINoMatchCoverType = new DataTable();

        if (Year > 10)
        {
            _dtTempCINoMatchCoverType = General.GetComboItem("CINoMatchCoverType", "CXBrokerProviderId", "0", true);
            if (_dtTempCINoMatchCoverType.Rows.Count > 0)
            {
                DataSet dsCINoMatchCoverType = new DataSet();
                for (Int16 i = 0; i < _dtTempCINoMatchCoverType.Rows.Count; i++)
                {
                    if (_dtTempCINoMatchCoverType.Rows[i]["ProviderCoverTypeDesc"].ToString().ToLower() == "comprehensive")
                    {
                        dsCINoMatchCoverType = General.RemoveRow(_dtTempCINoMatchCoverType, i);
                        _dtCINoMatchCoverType = dsCINoMatchCoverType.Tables[0];
                    }
                    else
                    {
                        _dtCINoMatchCoverType = _dtTempCINoMatchCoverType;
                    }
                }
            }
        }
        else
        {
            _dtCINoMatchCoverType = General.GetComboItem("CINoMatchCoverType", "CXBrokerProviderId", "0", true);
        }
        if (_dtCINoMatchCoverType.Rows.Count > 0)
        {
            ddlNoMatchCoverType.DataSource = _dtCINoMatchCoverType;
            ddlNoMatchCoverType.DataTextField = _dtCINoMatchCoverType.Columns[0].ColumnName.ToString();
            ddlNoMatchCoverType.DataValueField = _dtCINoMatchCoverType.Columns[1].ColumnName.ToString();
            ddlNoMatchCoverType.DataBind();
        }
        ddlNoMatchCoverType.Items.Insert(0, new ListItem("Select", "-1"));
    }

    protected void CheckVehicleNumber(object source, ServerValidateEventArgs args)
    {
        CarRegNo _carregno = new CarRegNo();
        if (_carregno.CheckVehicleNumber(txtVehicleNo.Text))
        {
            args.IsValid = true;
        }
        else
        {
            args.IsValid = false;
        }
        _carregno = null;
    }


    protected void CheckLast3Claim1(object source, ServerValidateEventArgs args)
    {
        if (txtClaimLast3NAF1.Text == "0" && txtClaimLast3AF1.Text == "0" && txtClaimLast3Windscreen1.Text == "0")
        {
            args.IsValid = false;
        }
        else
        {
            args.IsValid = true;
        }
    }

    protected void CheckLast3Claim2(object source, ServerValidateEventArgs args)
    {
        if (txtClaimLast3NAF2.Text == "0" && txtClaimLast3AF2.Text == "0" && txtClaimLast3Windscreen2.Text == "0")
        {
            args.IsValid = false;
        }
        else
        {
            args.IsValid = true;
        }
    }

    protected void CheckLast3Claim3(object source, ServerValidateEventArgs args)
    {
        if (txtClaimLast3NAF3.Text == "0" && txtClaimLast3AF3.Text == "0" && txtClaimLast3Windscreen3.Text == "0")
        {
            args.IsValid = false;
        }
        else
        {
            args.IsValid = true;
        }
    }

    protected void CheckLast2Claim1(object source, ServerValidateEventArgs args)
    {
        if (txtClaimLast2NAF1.Text == "0" && txtClaimLast2AF1.Text == "0" && txtClaimLast2Windscreen1.Text == "0")
        {
            args.IsValid = false;
        }
        else
        {
            args.IsValid = true;
        }
    }

    protected void CheckLast2Claim2(object source, ServerValidateEventArgs args)
    {
        if (txtClaimLast2NAF2.Text == "0" && txtClaimLast2AF2.Text == "0" && txtClaimLast2Windscreen2.Text == "0")
        {
            args.IsValid = false;
        }
        else
        {
            args.IsValid = true;
        }
    }

    protected void CheckLast2Claim3(object source, ServerValidateEventArgs args)
    {
        if (txtClaimLast2NAF3.Text == "0" && txtClaimLast2AF3.Text == "0" && txtClaimLast2Windscreen3.Text == "0")
        {
            args.IsValid = false;
        }
        else
        {
            args.IsValid = true;
        }
    }

    protected void CheckLast1Claim1(object source, ServerValidateEventArgs args)
    {
        if (txtClaimLast1NAF1.Text == "0" && txtClaimLast1AF1.Text == "0" && txtClaimLast1Windscreen1.Text == "0")
        {
            args.IsValid = false;
        }
        else
        {
            args.IsValid = true;
        }
    }

    protected void CheckLast1Claim2(object source, ServerValidateEventArgs args)
    {
        if (txtClaimLast1NAF2.Text == "0" && txtClaimLast1AF2.Text == "0" && txtClaimLast1Windscreen2.Text == "0")
        {
            args.IsValid = false;
        }
        else
        {
            args.IsValid = true;
        }
    }

    protected void CheckLast1Claim3(object source, ServerValidateEventArgs args)
    {
        if (txtClaimLast1NAF3.Text == "0" && txtClaimLast1AF3.Text == "0" && txtClaimLast1Windscreen3.Text == "0")
        {
            args.IsValid = false;
        }
        else
        {
            args.IsValid = true;
        }
    }

    protected void CheckRenewalQuote(object source, ServerValidateEventArgs args)
    {
        float iRenewalQuote = 0;

        if (txtRenewalQuoteReceived.Text != "0")
        {
            iRenewalQuote = float.Parse(txtRenewalQuoteReceived.Text);

            if (iRenewalQuote < 100 || iRenewalQuote > 30000)
            {
                args.IsValid = false;
            }
            else
            {
                args.IsValid = true;
            }
        }
        else
        {
            args.IsValid = false;
        }

    }


}
